File name or class name not found during automation operation

File name or class name not found during automation operation

Anonymous
Not applicable
4,087 Views
3 Replies
Message 1 of 4

File name or class name not found during automation operation

Anonymous
Not applicable
Hi all..

while running the program i am getting File name or class name not found during Automation operation error. the same program is running fine in another system. i added dao360.dll also.
i am getting error in the below statement

Set ExcelWorkbook = GetObject("E:\HCC External Area Details.xls")

can you pls help me

thanks in advance.
0 Likes
4,088 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
There is no need to add reference to dao360.dll: you are automating Excel
application.

Since you omitted the second argument og GetObject(), that is, classID, your
code is problemetic: there are more than 1 class associated to a *.xls file,
that is, all classes in Excel object model are associated to *.xls file, it
is not neccesarily Workbook object.

So, in this case, you should always use ClassID:

Set ExcelWorkbook=GetObject("[path]","Excel.Workbook")

The common approach most programmers use is to alway get Excel.Application
object first. If it succeeded, go ahead to open an Excel file. Some thing
like:

On Error Resume Next
'Get running Excel application
Set excelApp=GetObject(,"Excel.Application")
If Err.Number<>0 Then
Err.Clear
'If no existing Excel app running, launch one
Set excelApp=CreateObject("Excel.Application")
If Err.Number<>0 Then
MsgBox "Cannot start Excel."
Exit Sub
End If
End If

excelApp.Visible=True

'Open workbook
Set wkbook=excelApp.Workbooks.Open("[path"])
...
...

Of course, the computer does have Excel installed, doesn't it?


"anila" wrote in message news:6027715@discussion.autodesk.com...
Hi all..

while running the program i am getting File name or class name not found
during Automation operation error. the same program is running fine in
another system. i added dao360.dll also.
i am getting error in the below statement

Set ExcelWorkbook = GetObject("E:\HCC External Area Details.xls")

can you pls help me

thanks in advance.
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thank you for your help

Its working fine.
0 Likes
Message 4 of 4

Anonymous
Not applicable
I have one more problem.

in my system Excel.Application is highlighting. if give this its giving like this

dim xlApp as excel.Application

Application is not high lighting and Excel is appearing as excel.

can you pls help me in this

thanks in advance
0 Likes