Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Excel workbook from Access if not already open

Status
Not open for further replies.

doctorswamp

Technical User
Jul 15, 2003
133
GB
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


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top