Is there something else I have to do to get a message with an error occurs other than this:

On Error GoTo Handler
'Code that will cause an error
Handler:
msgBox(Err.Description)

The Handler gets thrown but it is empty.... Just a message box comes up with no text.

Recommended Answers

All 5 Replies

Just from looking at what you have, you are entering the error handler when no error actually exists (e.g. err.code=0). Try exiting your routine just before the handler.

On Error GoTo Handler

'Code that will cause an error

'Expected exit
Exit Sub 

Handler:
msgBox(Err.Description)
commented: Suggestion worked. +1

Add Exit Sub before the error handler.

yup, do as techtix and debasisdas said...
you need to exit the procedure or function first then go to handler.

Thanks guys...

you're welcome friend...
Happy coding :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.