Error trapping

S

Steve Wylie

How do you trap error messages in Word VBA? I looked on the HELP for
an ONERROR command but could not find it. What is the correct way to
trap errors?

Steve Wylie
 
J

JB

Steve said:
How do you trap error messages in Word VBA? I looked on the HELP for
an ONERROR command but could not find it. What is the correct way to
trap errors?

Steve Wylie
Hi Steve,
The Code should look like -

On Error Goto ErrHandle

'Your Code here

ErrHandle:
Msgbox "Your Application Encountered and Error" & Err.number &
Err.Description & Err.Source

Err.clear

Have a look at the Err object and see what can be done (open a form in
VBA and type Err, then highlight and press F1 to get a description).

I normally have a function to handle major errors in the app to which I
pass all the relevant info including preset variables in my Functions

HTH

J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top