Error handling: Err.Number is always 0

B

Beeawwb

Hi everyone,

I've been finishing up the project I'm working on, and I sent it to be
tested by one of my colleagues. A little background, previously we identified
that documents which had password protection would not work with our macro.
If the document was just protected everything would work fine. Example:

Select Case oDoc.ProtectionType
Case wdNoProtection
GoTo InitDoc
End Select
oDoc.Unprotect

If oDoc.Unprotect failed, it would generate error 5485, which was easy to
trap for. However, in my most recent code, all errors are now reported as
"0", so my error trapping (If Err.Number = 5485 Then ... ) no longer works.

I'm not doing anything special that I can see, I say "On Error goto
ErrorCatch" at the beginning of my code, and ErrorCatch is just the "Iff
Then" listed above.

Some things to note which may be of interest, I call other routines from
WhichLetterheadLoad(), but none of these are called before the
oDoc.Unprotect, apart from a Class module LogIt. LogIt has its own error
handling.

Thanks for your help on this confusing situation!

-Bob
 
B

Beeawwb

Looks like I've fixed it. The class module I was using was interfeering with
the Err object of the main Sub. When I turned off the On Error's in the LogIt
class, the Err.Number returned to correct operation. All fixed.

Now if only I could delete my posts here. :)

-Bob
 

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