Exchange Server is not Ready

C

CaptainBly

I have written a small access program that opens up Outlook, checks the
inbox for emails with a particular subject. It it finds one it grabs
some information out of it, formats a new excel spreadsheet and sends
this result to the requestor. I have this running unattended as a
scheduled task every 10 minutes on one of the clients servers.

This all works great. No problems at all.

Every once in a while though, for whatever reason, the Exchange server
is down. In the VBA when I try to do the "Set olookApp =
CreateObject("Outlook.Application")" it doesn't generate a trapable
error but Outlook pops up a warning box saying something to the point
of "The exchange server is not available at this time, would you like
to open anyway (Yes, NO)" My program just sits there waiting for
someone to say yes or no. The program has no idea that Outlook has
asked for user interaction.

Well, I have this program running as a scheduled task every 10 minutes.
The program will never take more than a minute or two to run. If this
thing pops up, it freezes my program because this is an unattended task
so no one is sitting there looking at it.

Is there some way, programatically to determine if exchange is up and
running or runnable before I try to initiate outlook? Or is there
someway to skip this error in Outlook? Even if exchange is not
available, my program will still work, the actual email just won't be
physically sent.

Any ideas? This is a real pain when Exchange is not available. It
ends up with a bunch of copies of access with the "A Serious error has
occured, would you like to send to microsoft....." error screen but in
reality, nothing bad happened, it was all just that exchange wasn't
there.
 
C

CaptainBly

I found the actual error that comes up if this is ov any more help:


Your Microsoft Exchange Server is Unavailable

The options are Retry, Work Off Line, or Cancel.

I would like it to automatically go into off line mode if that is
possible.
 
K

Ken Slovak - [MVP - Outlook]

That's why it's never a good idea to run Outlook automation code in an
unattended application. There can be many errors fired that you can't know
about and Outlook will just sit there waiting for a response. For unattended
execution you are better off coding it in CDO 1.21 or some server side type
code such as WebDAV or something like that.
 

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