Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

Error handling: Err.Number is always 0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Beeawwb - 21 Aug 2007 07:00 GMT
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
Beeawwb - 21 Aug 2007 07:36 GMT
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

> Hi everyone,
>
[quoted text clipped - 25 lines]
>
> -Bob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.