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 / Outlook / Programming VBA / January 2006

Tip: Looking for answers? Try searching our database.

Automatically trigger a VBA macro to run when connection to exchange server has been made.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
matt@littlealien.net - 25 Jan 2006 20:52 GMT
I am currently producing a very simple electronic in/out board for my
company. It works by using a public folder to which are posted the
names of everyone in a particular office. For each user you can select
whether you are in or out, where you are and when you are likely to
return.

I have written a number of VBA macros which can be run by the users to
update their status, the system also automatically marks them as out
when Outlook is closed.

I would like to call the "sign in" macro to run automatically when
outlook starts up, but as there is a delay between outlook starting and
finally connecting to our exchange server (very tempermental
connection) I need to call the sign in macro when the connection has
been established.

Does anyone know how I could call this macro to run at the right time?
Eric Legault [MVP - Outlook] - 30 Jan 2006 22:29 GMT
I've struggled with the best way to approach doing a startup task with
Exchange before and had to ping fellow MVP Ken Slovak to jog my memory; see
what he says below.  If you don't want to run your code on
Application_Startup, consider hooking into the SyncStart event for any of the
SyncObjects that are available for each Send/Receive group, even if none of
them are Exchange-specific.  These calls should at least give you some
seconds after startup to hope that an Exchange connection could be made in
the interim.

I would check a combination of NameSpace.ExchangeConnectionMode,
NameSpace.Offline (PR_STORE_OFFLINE for earlier than Outlook 2002)
and PR_REPLICA_VERSION (Exchange version, 0.0.0.0 for offline or
cached mode). That covers combinations of Outlook and Exchange
versions pretty well.

The old CDO way of putting PR_REPLICA_VERSION (PT_I8) into a string
for CDO 1.21 from the KB doesn't work when using Redemption. See
http://www.slovaktech.com/code_samples.htm#ExchangeVersion for a
Redemption version of the KB code.

Also, when retrieving PR_REPLICA_VERSION for Exchange 2000 and 2003
you get "6.5.xxxx.xxxx" for both. So you have to look at the minor
and build fields to see which version of Exchange.

http://support.microsoft.com/default.aspx?scid=kb;en-us;158530 lists
the versions, so you can use that to figure out EX2003 or EX2000.

Signature

Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/

> I am currently producing a very simple electronic in/out board for my
> company. It works by using a public folder to which are posted the
[quoted text clipped - 13 lines]
>
> Does anyone know how I could call this macro to run at the right time?
 
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.