Free Microsoft Excel 2013 Quick Reference

createObject(Excel.application) Automation server cannot create object

Hi,

When I used createObject(Excel.application) to create ActiveX object using javascript, it ran fine when it executed locally. However, I got 'automation server cannot create object' error when it ran on server. Any ideas?

Thanks for your help,

cindy


Hi,

I used createObject(Excel.application) to create ActiveX object in javascript, it ran fine when it executed locally. However, I got 'automation server cannot create object' error when it ran on server. Any ideas?

Thanks for your help,

cindy

Hi,

I am getting a "ActiveX component cannot create object" error whenever I open Excel 2003(and Word). When I click OK, I get the error "Run-time Error 91:Object variable or with block variable not set". I should also say that we are running Windows Terminal Server on the machine, but this problem just recently started occuring. Here is some of the code from debugging:

Code:
Public WithEvents App As Application
Private Sub App_WindowDeactivate(ByVal Wb As Excel.Workbook, ByVal Wn As Excel.Window)
    Dim lReturn As Long
        If Application.Workbooks.Count = 1 And Not oIDMMacros Is Nothing Then
        lReturn = oIDMMacros.CIDMMacroAPI_IDMUpdateMenu(APPLTYPE, Application, True)
    End If
End Sub
Private Sub App_WorkbookActivate(ByVal Wb As Excel.Workbook)
    Dim lReturn As Long
    If oIDMMacros Is Nothing Then
        Auto_open
    End If
   lReturn = oIDMMacros.CIDMMacroAPI_IDMUpdateMenu(APPLTYPE, Application)
End Sub
The code in red is what VB is indicating as the problem. Is there a DLL or Macro that needs to be registered? I've tried lots of things and am at a loss...

Not really sure if it's excel or access question

An application is trying to open Excel from Access. Has been working fine for over a year, still works on all PCs except 1.
On that particular PC code breaks on


	VB:
	
 X = CreateObject("Excel.Application") 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
if I put

	VB:
	
 X = CreateObject("ADODB.Connection") 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
It goes fine past that line, so it means that 'CreateObject' works fine, it's just cannot create Excel

I checked References, nothing is MISSING
Are there any dlls that are required or anything like that ?

Hi,

(Please let me know if this is /is not the correct forum;since it
deals with excel programmming ,i thought this would be a good place to
start with.The sitaution that i am attempting to portray is really
vague ,please excuse me for any incomplete data)

Application Aim:-

I have an application coded using vb6.0 and it uses excel to do some
formatting on input excel sheets.This is done through ole automation.I
use late binding i.e

createobject("excel.application") to get a valid object of
excel.Following this line i have a error trapping code reading

if err.number0 then print error message.

Assume that the above application is in system A.In system A there is
a folder that is shared and mapped as F (any logical drive
names).There is a batch file which calls this application against
input files in the shared folder.The application exists as an exe in a
path inside this shared folder

There are 2 more systems System B and System C, which map drive F to
the shared folder in system A.System A holds many batch files which
call the application against different set of input files.

The situation that i faced is that system A is executing a batch file
and so are systems B and C(against different input files).It may be
possible that some of the input files are common(this stage of usage
doesn't matter as the error occurs much before this.

My problem is that the batch file involving the application(against
one set of input files ) flags the error "activeX component can't
create object error" and exits since no further action is possible.

How is this possible.When i tried to reproduce this situation with no
system B or C connected or logged on with the same user id that was in
system A, i couldn't. There was no such problem.

Is it really possible to throw some light on what is happening.I guess
there is violation of some access (max limit ).The following microsoft
KB article gives vague reason for this ( based on the error
description)

ttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vamsgcantcreateobject.asp

The last probable cause listed seems to fit but i would like to know
how so that i can avoid situations like this.

With Regards
Gopal

Until now the simple code below worked properly:

Dim xlApp as Object 'or Excel.Application
Set xlApp = CreateObject("Excel.Application")

Since few days the debugger pauses at this line with error 70 ('Access
denied').

The code properly works for Access.Application, Word, Outlook, but not for
Excel.
Another phaenomenon is, that selecting a Hyperlink in a Cell calls an
"Unknown error",
instead of the resepctive URL.

I'm working with Windows XP, Office XP, Norman, McAffee Firewall (all
up-to-date).

Thanx from Switzerland
LUCA

Hi All,
I Am getting the following error,

"RunTime error 429
ActiveX Object Cannot Create Object"

Your help will be highly appreciated,
Thanks in advance,

I'm trying to generate an email message with excel. The first part of my code includes this:

Code:
Dim OutApp As Outlook.Application
Set myOlApp = CreateObject("Outlook.Application")
Upon excecuting this I get a runtime error 429.

My Stats:

Windows XP
Excel 2003

References:

Visual Basic for Applications
Microsoft Excel 11.0 Object Library
OLE Automation
Microsoft Office 11.0 Object Library
Microsoft Office Outlook View Control
Microsoft Outlook 11.0 Object Library

Does anyone know what I should do?

Hi, there
I try to create an "Excel.Application" object using CreateObject function, I got "nothing" from the return variable without any error messages, but It works well on another computer, we have the same environment settings(include same references setting) on those 2 computers: Win2k/Sp4, VB6/Sp5, Mdac_type2.7, the following is source code snippet

Public appWorld As Excel.Applicatio
Public wbWorld As Excel.Workboo
Sub Setup()
On Error Resume Next 'ignore error
Set appWorld = GetObject(, "Excel.Application"
If Err.Number 0 The
Set appWorld = CreateObject("Excel.Application") 'run i
End I
Err.Clea
End Su

I got "nothing" from "appWorld", even I remark all of error handle lines, the same result I got, pls help me,thanks

Hi,
I am trying to generate excel report output from access by click of a button. Part of the code is as follows:
Dim lngColumn As Long
Dim xlx As Object, xlw As Object, xlc As Object
Dim DBS As DAO.Database
Dim rst As DAO.Recordset
Dim blnEXCEL As Boolean, blnHeaderRow As Boolean

blnEXCEL = False

'If we do not want the first row we set Header to false
blnHeaderRow = False

'Establish an EXCEL application object
On Error Resume Next
Set xlx = GetObject(, "Excel.Application")

If Err.Number <> 0 Then
Set xlx = CreateObject("Excel.Application")
blnEXCEL = True
End If
Err.Clear
I worked on development on a server and worked fine. However when I have moved the code and database to the desktop of mine I am having
the following error in the line

Set xlx = GetObject(, "Excel.Application")
I cannot figure out how to fix this. I appreciate any help for resolution. Thanks.

Run-time error '429'
ActiveX component can't create object

VBScript code snippet below is being used in an ASP page but the call to GetObject never attaches to a running instance of Excel. Since visible property is set to True, I can see the instances accumulate in the TaskBar each time the ASP page is called, so there are obviously instances to attach to.


	VB:
	
 excelApp 
Set excelApp = Server.GetObject(,"Excel.Application") 
If (err  0) Then 
    Set excelApp = Server.CreateObject("Excel.Application") 
End If 
excelApp.UserControl = True 
excelApp.Visible = True 
excelApp = Nothing 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
GetObject errors out with the following error:

Error - Number:429 Source:Microsoft VBScript runtime error Description:ActiveX component can't create object

Any ideas why?

Have tried everything I can think of and every permutation and example I have found online while researching this. Any ideas?

Running Excel 2003 on IIS 6 and Windows Server 2003.

Thanks,
Brian Barnett

PS. If this post is off topic for this forum, any suggestions where I could ask it?

Hi,
Before this code is run, I have two workbooks open (One where all
the code and forms are, and the other is just a database of
information). I am trying to create a report from my application using
a template (.xlt file) I created. The code below is just a test to see
if my copying and pasting between two Excel application objects is
working, but it isn't. On the set tempRow = ... I keep getting a Run
Time error 1004 "application-defined or object-defined error"

Anyone got any idea how to fix it?

Thanks

Dim currTemplate As String
currTemplate = MyPath & BACKSLASH & templateContainer & BACKSLASH &
Template1

Set tempApp = CreateObject("Excel.Application")
Set tempWB = tempApp.Workbooks.add(currTemplate)
Set tempWS = tempWB.Sheets(1)

tempApp.Visible = True

For i = 3 To 10
'db.Worksheets("dbdata").Select
Set foundRow = db.Worksheets("dbdata").Range(Cells(i, 1),
Cells(i, 5))
Set tempRow = tempWB.Worksheets(1).Range(Cells(i, 1), Cells(i,
5))
Debug.Print foundRow.Address
Debug.Print tempRow.Address
foundRow.Copy
tempRow.PasteSpecial
Next i

I'm trying to open a file and perform various tasks. This is the structure:

Code:
Dim xlApp As Object
Dim xlWb As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open(BackupFile) ' backupfile evaluates to c:testingtest.xls
xlWb.Worksheets(1).Activate

Debug.Print xlWb.Worksheets.Count
Dim ws As Worksheet
For Each ws In xlWb.Worksheets
    Debug.Print ws.Name
    ws.Activate
Next ws
I think I'm totally missing something. The above works, except for the loop. None of the names show up in my immediate window, and none of the worksheets are activated. xlWB evaluates to nothing, which is where the problem has to be...but why would my first .Activate and Debug.Print lines work? Also, If I declare xlWb as Workbook then absolutely nothing works after the file is opened.

Basically what I want to do is open the file, do a bunch of a stuff with it, then save and close it. I have this all working without creating another object, but the opening of the file is still visible to the user. Seems like turning off ScreenUpdating doesn't truly work - I don't want the user to see anything. The only way I've been able to accomplish this is to create a new object and work with that.

Ideas? Thanks.

I am having trouble with the following code... I get error # 429 Active X can't create the object...

Is any one familiar with this problem...

Code:
Dim blnIOpened As Boolean

Err.Number = 0
On Error GoTo failed
blnIOpened = False
Set MyXL = GetObject(, Excel.Application)

failed:
If Err.Number = 429 Then
  Set MyXL = CreateObject(Excel.Application)
  blnIOpened = True
End If

If Err.Number  429 Then
MsgBox Err.Number

End If
Any advice would be greatly appreciated....

Hi Everyone,

I am having trouble constructing a block of code that is intended to
open a workbook and read some sheet data the worksheets in it. The
code works fine when it is early bound, but when shifting to late
binding there is a problem with the .EnableEvents changing state from
False to True when I open the first workbook. This is a problem
because the workbooks are designed to start-up with a form, and when
the code opens the workbook the form is opened with it but behind all
other forms - it should not be there at all as I understand it.

My code is as follows (Standard Module):

Option Explicit

Const xlWorksheet As Long = -4167
Const xlChartSheet As Long = 3

Sub test()

Dim XL As Object 'Excel itself
Dim WB As Object 'Workbook
Dim ws As Object 'Worksheets Collection
Dim ss As Object 'Spreadsheet (not set, just stays as object)

Dim folder As String
Dim Files As Variant
Dim Filename As String

Dim i As Long

Dim Proceed As Boolean

On Error GoTo ErrorHandler

folder = BrowseFolder
Files = GetAllFilesInDir(folder)

Set XL = CreateObject("Excel.Application")

XL.DisplayAlerts = False
XL.Application.DisplayAlerts = False
XL.Application.EnableEvents = False
XL.EnableEvents = False

For i = 0 To UBound(Files)
If Right(Files(i), 3) = "xls" Then

Filename = folder & "" & Files(i)

Set WB = XL.Workbooks.Open(Filename)

Set ws = XL.ActiveWorkbook.Sheets

For Each ss In ws
Proceed = SheetTest(ss)
Debug.Print Filename & vbTab & vbTab & ss.Name & vbTab &
CStr(Proceed)
Next

Set ws = Nothing
WB.Close savechanges:=False
End If
Next

Set ws = Nothing
Set WB = Nothing
Set XL = Nothing

Exit Sub

ErrorHandler:
Debug.Print Error & vbTab & Err
Stop
Resume Next
End Sub

I will eventually shift this to a class module when I can get it to
work. Is there any reason why the .EnableEvents = False is not
remaining in the state it is set to for the Excel.Application object?
I need to stop these workbook events from being fired. Is there
another way? It would be great to be able to take this code and use it
in other MS Office applications and keep it version inpedant at the
same time (ie/ using late binding to avoid dependancies).

Using Excel 2000 9.0.8950 SP-3

Any help greatly appreciated. I am really stumped.

The Frog

All,

I have a computer that has multiple versions of MS Excel. How can I
instantiate and automate a specific version?

I've tried several attempts using the late bound functions, CreateObject and
GetObject, but no matter what, I always instantiate the current version.
Here is a sample of what I tried

Dim obj as Object
Set obj = CreateObject("Excel.Application.10")
MsgBox obj.Version
Set obj = Nothing

This code always instantiate the current version in the registry. I suppose
I could modify the current version in the registry before instantiating
Excel but I would rather not have to do that. I would much rather have
something that reads like this pseudo code:

Dim obj as Object
If (VersionNeeded = 8) Then
Set obj = CreateObject("Excel.Application.8")
ElseIf (VersionNeeded = 9) Then
Set obj = CreateObject("Excel.Application.9")
ElseIf (VersionNeeded = 10) Then
Set obj = CreateObject("Excel.Application.10")
EndIf
MsgBox obj.Version
Set obj = Nothing

Can anyone help me?

Thank you,
Tom

Hi

I have an excel application that uses a vb6 activex exe component.
On my machine everything works fine (as always...)

however when i install the excel file on another computer and i'm
trying the following line:
MyExeObj = new ExeObj

I get activex cannot create component error.

when i remove the exe reference and add it again the line works.

does anyone have an idea how to make it work without re-reference the
exe ??

10x.

Il contesto =E8 questo:
Sto migrando una applicativo asp che visualizza dei grafici creati da
excel da win2000(iis 5.0) a win2003(iis 6.0)

Il problema =E8:
un errore di autorizzazione quando istanzio l'oggetto excel(
Server.CreateObject("Excel.Application") ) :

L'errore che mi restituisce =E8:
---
006~ASP 0178~
Impossibile eseguire il metodo Server.CreateObject~Impossibile
richiamare il metodo Server.CreateObject durante la verifica delle
autorizzazioni. Impossibile accedere all'oggetto
---

Premetto che:
a) lo stesso applicativo web funziona su win2000 iis 5.0
b) le impostazioni (autorizzazione sulle cartelle fisiche, etc...) sono
le stesse del vecchio server(win2000)
c) ho abilitato gli OOP con lo script vbs

N=2EB.
L'unico modo per far funzionare il tutto =E8 impostare l'utenza(di
dominio) con la quale mi autentico sul sito come Amministratore della
macchina dove si trovano i sorgenti.
E' chiaro che ci=F2 non pu=F2 essere la soluzione

Potete aiutarmi?
Grazie mille.

Send Emails

Ok -

I have the following code (posted at bottom) that errors out at

**Set OutApp = CreateObject("Outlook.Application")**

the error message is

Run-time error 429
ActvieX component cannot create object

I have the reference set
(You must add a reference to the Microsoft outlook Library.

1) Go to the VBA editor, Alt -F11
2) Tools>References in the Menu bar
3) Place a Checkmark before Microsoft Outlook 9 Object Library
)

It works on other machines (PCs with the same build as mine) so where
am i going wrong?

Sub sendEmails()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim cell As Range

Application.ScreenUpdating = False

Set OutApp = CreateObject("Outlook.Application")

On Error GoTo cleanup
For Each cell In Sheets("Send
Emails").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Offset(0, 1).Value <> "" Then
If cell.Offset(0, 1).Value <> "" Then

Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = cell.Value
.Subject = "Budget for " & cell.Offset(0, 2).Value
.Body = "Dear " & cell.Offset(0, -1).Value & vbCrLf &
vbCrLf
.Body = .Body & "Please find attached latest update
showing the actuals against budget for " & cell.Offset(0, 2).Value &
vbCrLf & vbCrLf

If cell.Offset(0, 3) <> "" Then
.Body = .Body & cell.Offset(0, 3).Value & vbCrLf &
vbCrLf
End If
If cell.Offset(0, 4) <> "" Then
.Body = .Body & cell.Offset(0, 4).Value & vbCrLf &
vbCrLf
End If
.Body = .Body & "If you have any queries
- please let me know. " & vbCrLf & vbCrLf
.Body = .Body & "Many thanks " & vbCrLf & vbCrLf
.Body = .Body & "Systems Finance Team" & vbCrLf &
vbCrLf
.Attachments.Add cell.Offset(0, 1).Value
.Display 'Or use Display
If cell.Offset(0, 5) = "Y" Then
.ReadReceiptRequested = True
Else
.ReadReceiptRequested = False
End If
End With
Set OutMail = Nothing
End If
End If
Next cell
Exit Sub

Can anyone tell me how to find/get a list of Excel class automations?

I'm creating some vbScript code to do some Excel tasks, but am unsure what those class names are.

IE> EXCEL.APPLICATION

Is there a way to see these from within VB or Excel?

Hello,

The following testing code will be executed without an error with
windows server 2003 and asp.net. However Excel will remain in the
process list until i kill the process or reboot the computer.

<script language='vb' runat='server'>

Private Sub Page_Load()
Dim excelApp

excelApp = CreateObject("Excel.Application")
excelApp.Quit()
excelApp = Nothing
response.write("OK")
End Sub

</script>

In asp, the excel application will be closed with the same statements,
but not in asp.net.

I have tried to add Microsoft.Excel library reference and to explicitly
declare the variables, but it didn't change anything.

I am using ws2003 with asp.net and office xp.
Anyone could tell me what to do ?

Thanks.

Hello,

I am trying to copy one sheet to newly created workbook but I have problems when doing it with new instance of the excel application

Sub test()
Dim objExcel As Excel.Application
Dim book As Workbook

Set objExcel = CreateObject("Excel.Application")
Set book = objExcel.Workbooks.Add
objExcel.Visible = True

ActiveSheet.Copy book.Worksheets(1)

End Sub
Any ideas how this could be done?

Thanks
Bob@Sun

This is driving me crazy; I’ve been searching the boards all day for a solution but just can’t find anything even remotely relevant. I’ve finally admitted defeat and decided to post the question

I’m simply trying to copy all the data on one sheet, open up a new excel application:

Set objExcel = CreateObject("Excel.Application")

objExcel.Workbooks.Add

and then paste all the information to the new workbook. When I try, the charts don’t paste, only the values and formats. Please, anyone…help!!!

Hello!
I have this code, and it is supposed to drow graphs dynamicly from access
table to excel. It does it ok, but when I close excel I get message "Problem
""CreateXLChart() Error 1004: Unable to get the Axes Property of the Chart
class". Does anyone know why, and what I should to to stop getting it?
Thanks!

Private Sub Command24_Click()

On Error GoTo ErrorHandler
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
Dim wb, wb1 As Object
Dim db As Database
Dim rs As DAO.Recordset

Dim i, j, k As Integer
Dim iRowCount As Integer
Dim iBorder As Integer
Dim iFieldNum As Integer
Dim iRecordCount As Integer
Dim s As String
Dim sSQL As String
Dim sDate As String
Dim Spath As String
Dim Sfile As String
Dim sSysMsg As String
Dim vSysCmd As Variant
sSysMsg = "Creating Excel Chart Test"
Set wb = xlApp.workbooks.Add()
Set db = CurrentDb
Spath = "C:"
Sfile = "Excel Chart Test"

sSQL = "SELECT * " _
& "FROM QZbirnaK " _
& "ORDER BY Datzbir;"
Set rs = db.OpenRecordset(sSQL, dbOpenSnapshot)
rs.MoveLast 'force error 3021 if no records
rs.MoveFirst
iRecordCount = rs.RecordCount
vSysCmd = SysCmd(acSysCmdInitMeter, sSysMsg, iRecordCount)
xlApp.Visible = True
'' wb.worksheets(1)
wb.worksheets(1).Name = "ChartData"
wb.worksheets(1).Cells(1, 1).Value = "Podaci za Dijagram ZBIRNE tabele"

i = 2
For iFieldNum = 1 To rs.Fields.Count
wb.worksheets(1).Cells(i, iFieldNum).Value = rs.Fields(iFieldNum - 1).Name
Next
i = i + 1
Do Until rs.EOF
For iFieldNum = 1 To rs.Fields.Count
wb.worksheets(1).Cells(i, iFieldNum).Value = Nz(rs.Fields(iFieldNum - 1), "")
Next
vSysCmd = SysCmd(acSysCmdUpdateMeter, i)
i = i + 1
rs.MoveNext
Loop
iRowCount = i - 1
'' xlApp
xlApp.Charts.Add
xlApp.ActiveChart.SeriesCollection(1).XValues = "=ChartData!R3C1:R" &
iRowCount & "C1"

For j = 3 To rs.Fields.Count
k = j - 2
If k 2 Then
xlApp.ActiveChart.SeriesCollection.NewSeries
End If
xlApp.ActiveChart.SeriesCollection(k).Name = "Serija " & k & ": " & wb.
worksheets(1).Cells(2, j).Value
xlApp.ActiveChart.SeriesCollection(k).Values = "=ChartData!R3C" & j & ":R" &
iRowCount & "C" & j
Next
xlApp.ActiveChart.HasTitle = True
xlApp.ActiveChart.ChartTitle.Caption = "Prikaz Dijagrama ZBIRNIH TABELA"

xlApp.ActiveChart.axes(xlCategory, xlPrimary).HasTitle = True
xlApp.ActiveChart.axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "x-
osa"
xlApp.ActiveChart.axes(xlCategory).TickLabels.Orie ntation = 45

xlApp.ActiveChart.axes(xlValue, xlPrimary).HasTitle = True
xlApp.ActiveChart.axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "y-
osa"

For iBorder = 7 To 11
Next
End ''
'' wb.Range("A2:B2")
For iBorder = 7 To 10
Next
End ''
End ''
GoTo ThatsIt
ErrorHandler:
Select Case Err.Number
Case 3021
Case Else
MsgBox "Problem '' CreateXLChart()" & vbCrLf _
& "Error " & Err.Number & ": " & Err.Description
End Select
ThatsIt:
vSysCmd = SysCmd(acSysCmdClearStatus)
If iRecordCount = 0 Then
wb.Close SaveChanges:=False
xlApp.Quit
End If
Set wb = Nothing
Set xlApp = Nothing
Set rs = Nothing
Set db = Nothing

End Sub

--
Message posted via http://www.officekb.com

When I open an Excel Application via VBA the Analysis ToolPac functions are
not loaded. (Specially I want to see the function "EDATE" but there are
others nice functions.)

VBA:
Dim appWB As Excel.Application

Set appWB = CreateObject("Excel.Application")
appWB.Workbooks.Open Filename:="c:mydocsmyXLWB.xls", ReadOnly:=False
appWB.Visible = True

Even when I set the addins property to True they are not recognized:

'Install Analysis Tool pack
AddIns("Analysis ToolPak").Installed = True

Any Suggestions?

Thank you,
Mark