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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Automating GetObject (despite On Error) 2

Status
Not open for further replies.

mkasson

Programmer
Jan 3, 2004
36
There is plenty of documentation on opening another application. My instance in Access VBA looks like the following:

Code:
Dim oApp As Object
...
    On Error Resume Next    ' Defer error trapping.
    Set oApp = GetObject(, "Excel.Application")
    If Err.Number = 429 Then
    ExcelWasNotRunning = True
    Err.Clear
    Set oApp = CreateObject("Excel.Application")
    End If

The problem that I have is not so much with the code (I took it from a previous project). The problem is that despite the On Error, I am still getting an error box telling me of the 429 error "ActiveX component can't create Object" (the GetObject is failing because the Excel is not running).

Why is my On Error being ignored?

- MSK
 
Tools/Options/General - and select 'Break on Unhandled Errors' rather than 'Break on All Errors'
 
Ouch. Thanks.

I'm a little surprised the on-line help for On Error didn't mention it.

Many thanks.

- MSK
 
Ouch. Thanks.

I'm a little surprised the on-line help for On Error didn't mention it.

Many thanks.

- MSK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top