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

Err.description not showing what I expect

Status
Not open for further replies.

christhedonstar

Programmer
Apr 9, 2007
215
GB
when running this code I get a message box saying "Problem opening file" as expected. But when I run similar code from another workbook I get the message box: "Automation error Not able to bind to the source"

Obviously I haven't posted the code that propogates this but I figured this might be a known issue, I've stepped through the code and seen me raise the error and the next thing that happens is that it jumps into the next calling procedure with an error handler and somehow the error description has changed. I'm raising the error in the same way and capturing it at the same number of calling procedures up.

Any ideas?? Thanks a lot, Chris.



Sub test()
On Error GoTo ErrHandler
testTest

ErrHandler:
MsgBox Err.Description

End Sub



Sub testTest()

testOpenWorkbook

End Sub

Sub testOpenWorkbook()

On Error GoTo ErrHandler

Workbooks.Open "Hello.xls"
Exit Sub

ErrHandler:

Err.Raise vbObjectError + 10, , "Problem opening the file"

End Sub
 
Since this code gives you the error you expect, why do you not post the code that give you the error you do not expect.


ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top