M
Morris
Hi everyone,
Only yesterday I made some Excel operations in another database and
everything was working fine, so today I'm trying to do it in another
one and it fails.
I've got Access 2003. I choose
'Modules' from the left hand side, create a new module, put this code
in:
public sub subCreate()
Dim objXLApp As Object
Dim objXLWb As Object
Dim objSheet As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLWb = objXLApp.Application.Workbooks.Open("c:\temp\gps.xls")
Set objSheet = objXLWb.Worksheets(1)
(...)
end sub
And it stops on line: Set objXLWb =
objXLApp.Application.Workbooks.Open("c:\temp\gps.xls")
with an error: Runtime error 1004, Unable to get the 'Open' property
of the Workbooks class
the only difference to my yesterday's database is that it was a part
of a form - therefore the code was located in
Microsoft Office Access Class Objects, but can I make it somehow work
as a module?
Ps. I've joined the references to Mictrosoft Excel 11.0 Object Library
Cheers,
Morris
Only yesterday I made some Excel operations in another database and
everything was working fine, so today I'm trying to do it in another
one and it fails.
I've got Access 2003. I choose
'Modules' from the left hand side, create a new module, put this code
in:
public sub subCreate()
Dim objXLApp As Object
Dim objXLWb As Object
Dim objSheet As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLWb = objXLApp.Application.Workbooks.Open("c:\temp\gps.xls")
Set objSheet = objXLWb.Worksheets(1)
(...)
end sub
And it stops on line: Set objXLWb =
objXLApp.Application.Workbooks.Open("c:\temp\gps.xls")
with an error: Runtime error 1004, Unable to get the 'Open' property
of the Workbooks class
the only difference to my yesterday's database is that it was a part
of a form - therefore the code was located in
Microsoft Office Access Class Objects, but can I make it somehow work
as a module?
Ps. I've joined the references to Mictrosoft Excel 11.0 Object Library
Cheers,
Morris