Open Excel from Access

rizabdullah

Registered User.
Local time
Today, 22:19
Joined
Mar 17, 2015
Messages
15
Hi Guys

I am trying to open .XLSM excel file from Access module but I am getting error message "run time error -2147417846 (8001010a) automation error the message filter indicated that the application is busy".
My code is:
Function runExcelMacro(wkbookPath, macroName)
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("K:\default\Access Routine\Final Files\Miniroll - Copy.xlsm")
objXLApp.Application.Visible = True
End Function

Can someone please advise...

Many thanks
 
Is EXCEL OBJECT LIBRARY in the VBE references?

Is K assigned as a drive letter?
You should always use UNC paths: \\server\folder\file.xls

but the rest looks correct.
 
Many thanks for the response.
I have VB for application, MS Access 15.0 object library, MS DAO 3.6 object library, OLE Automation, MS VB basic for app extensibility 5.3, MS ActiveX data object 2.1 library & MS outlook 15.0 object library
 
Why not Microsoft Excel xx.0 Object Library ?
 
Just tried that, still same error. It's failing on:
Set objXLApp = CreateObject("Excel.Application")
 
thats usually all it takes.
It could be the PC. I have seen failures on 1 PC , but not another.
Can you try it another PC?
 
If the file is in use, it will not ipen. Add error handler on your code.
 
I have the code below in one of my modules and that works fine?
Not sure what the difference would be, but worth trying?, if only to debug the problem.?

Code:
Set XLApp = New Excel.Application
 
It works fine from another pc.

Many thanks for you assistance guys
 

Users who are viewing this thread

Back
Top Bottom