Outlook stuck when closing

P

PeterQ

hello Team,

I am developing some vba-macro's in Outlook 2000 using CDO and the
Profman library that goes with the Redemption library.

One thing I do is to walk through the entire addresslist to see if the
current user has access to the mailboxes that correspond to the
addressentries in the addresslist.
To check this I first add the mailbox to Outlook using the Profman
example on the redemption web site under "Profiles". Then I test to see
whether I have access to this mailbox with the next line of code:

i = Application.Session.Folders_
("Mailbox - " & sEntry).Folders.Count

When no error occurs and the value in "i" > 0 then I do not remove the
mailbox from Outlook with the Profman lib routines.

It works great. I can detect now automatically what mailboxes are
accessible or not. Some mailboxes produce here a runtime error and
others give back "0" as the number of accessible folders. (and the right
ones return i>0 of course).

However, when I want to shut down Outlook, it does not shut down
completely: the small box displaying "Outlook shutting down" keeps
showing and I will have to shut down both Outlook and Mapisp32 manually
using the taskmanager.
And I am sure, that this is due to the errors that happen as i am trying
to access a mailbox to which i do not have access privileges. But i do
not see how to solve this.

Does anyone have a good idea to solve this ?
(the only profile that i can use from my client pc to pass to by example
CDO is "Microsoft Exchange Server").

greetings,
Peter
 
K

Ken Slovak - [MVP - Outlook]

Usually if Outlook won't close it means you aren't releasing all your
objects explicitly. You must set them all = Nothing at the end of each
procedure and release all global objects in your shutdown code. You should
also handle all errors, at least with an On Error Resume Next statement.
 

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