Is Outlook Running???

Guy Boswell

Registered User.
Local time
Today, 15:17
Joined
Jul 20, 2009
Messages
26
I have database that creates and sends emails. It all works fine :p

Doesn't matter if Outlook is running or not. If it isn't running it just opens Outlook ;)

But! The way Outlook is set up in our organisation it takes about three or four clicks and a couple of moments to open and give the password each time. Way outside of my control :(

So it is just much easier for the user if they already have Outlook running in the background so they don't need to log on. :)

So what I want to do is one of two things. Both start when opening the database by checking, "Is Outlook running?" :confused:

a) If Outlook not running then msgbox "you would make life easier for yourself if you went and logged on to Outlook before continuing"

or

b) If Outlook not running then start Outlook running with message box to explain why.

Can I do either of these? If so how? I would expect to drop the If statement in to a simple utility sub I run OnOpen for my opening form.

If it helps we are running Office 2003 SP2 in Windows 2000 Professional SP4 with Novel Client 4.91 SP2 and ZenWorks 4.0 IR6 (what ever that all means? It just comes up on our desktop wall paper) and that will be the same for all users.

Thank you very much for any help and guidance :D
 
Hi Guy

this will check if outlook is running. as you already have code to open outlook if it is not already open, you can adapt it to suit and i will comment in the code-

Code:
Public sub CheckOutlookExists()
  Dim objOutlook As Object
  On Error Resume Next
  Set objOutlook = GetObject(, "Outlook.Application")
  On Error GoTo 0
  If objOutlook Is Nothing Then
    'Your code to open outlook goes here because outlook is closed
    'Then, Display your message
    MsgBox ("Outlook has been opened to assist this database")
    Cancel = True
  Else
    'Do whatever here
    'Display a messagebox if you wish
  End If
End Sub

this routine can be called when your database opens either by an AutoExec or by the OnOpen event of the first form or switchboard

if you dont know how to call the routine, simply place
Code:
CheckOutlookExists
on one line of the routine


HTH

Nidge
 
Last edited:
Thank you very much Nidge - that works a treat :-)
 

Users who are viewing this thread

Back
Top Bottom