doctorswamp
Technical User
Hi all
I've successfully used GetObject and CreateObject to open Word from Access if not already open, or use an open instance otherwise.
Converting this for Excel gives this error
Run-time Error '429'
ActiveX component can't create object
The code I'm using is
Dim objXL as Object
Dim .... various
On Error Resume Next
Set objXL = GetObject(, "Excel Application")
If Err.Number > 0 then
Set objXL = CreateObject("Excel.Application")
End If
If Excel is already running it works fine, and uses the open Excel version as many times as the code is run.
Otherwise it stops and highlights the GetObject line.
Any thoughts will be much appreciated
I've successfully used GetObject and CreateObject to open Word from Access if not already open, or use an open instance otherwise.
Converting this for Excel gives this error
Run-time Error '429'
ActiveX component can't create object
The code I'm using is
Dim objXL as Object
Dim .... various
On Error Resume Next
Set objXL = GetObject(, "Excel Application")
If Err.Number > 0 then
Set objXL = CreateObject("Excel.Application")
End If
If Excel is already running it works fine, and uses the open Excel version as many times as the code is run.
Otherwise it stops and highlights the GetObject line.
Any thoughts will be much appreciated