Opening Outlook during DB log-in process using VBA

JeffBarker

Registered User.
Local time
Today, 07:44
Joined
Dec 7, 2010
Messages
130
NB - This post has now been solved!!

Thanks to CBrighton in this post: http://www.access-programmers.co.uk...ighlight=check+if+outlook+is+open#post1101277

Simply adding this code does the trick:

Code:
Dim objOutlook As Object
    On Error Resume Next
    Set objOutlook = GetObject(, "Outlook.Application")
    On Error GoTo 0
 
    If objOutlook Is Nothing Then
    VBA.shell "outlook.exe"
---------------------------------------------------------------

ORIGINAL POST:

Hello all - I've spent a good few hours googling and searching on this very forum for a decent solution to this problem, and so far I've been completely unsuccessful.

I've tried: http://bytes.com/topic/access/answers/891620-determine-if-outlook-open-if-not-open

And: http://www.ozgrid.com/forum/showthread.php?t=73886

And: http://www.pcreview.co.uk/forums/need-vba-code-check-if-msoutlook-open-t3847373.html

But to no avail.

I'm currently using:

Code:
VBA.shell "outlook.exe"

to open Outlook after a user has succesfully entered their password at the log-in stage, but what I really need the DB to do is to check if an instance of Outlook is already open on their desktop. If they have an Outlook session open already then the DB does nothing, but if they don't have an Outlook session open already then the DB creates a new one at Inbox level.

Right now, the DB stacks new instances every time you log in during the day. This isn't a problem for the users as they tend to have the same instance of the DB open during the day, but as a developer I'm dipping in and out and it can be annoying closing multiple Outlook windows three or four times a day.

Can it be done? If so, does anyone know how to do it? If so, can you post the code below? It will save me losing more hair! :)

Thanks guys, very much in advance.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom