PDA

Click to See Complete Forum and Search --> : [RESOLVED] how to know if outlook is running or not?


neoxavier
Jul 5th, 2006, 04:00 AM
Haloo

I m new here, and I want to make a program that only run if outlook2002 is not open. so if outlook is open it will abort.
how to check if the outlook office is open or not
can somebody tell me the syntax how to recognize wether outlook is running or not.

thanks a lot

Static
Jul 5th, 2006, 08:16 AM
Use this function to check

Private Function OutlookRunning() As Boolean
On Error GoTo NotRunning
Dim OTL As Object
Set OTL = GetObject(, "Outlook.Application")
Set OTL = Nothing
OutlookRunning = True
Exit Function
NotRunning:
Set OTL = Nothing
OutlookRunning = False
End Function

Private Sub Form_Load()
If Not OutlookRunning Then
MsgBox "Its Not Running"
Else
MsgBox "Its Running"
End If
End Sub

neoxavier
Jul 5th, 2006, 08:27 AM
ok i will try that.. thanks..
i can not make it at the moment because i dont have vb compiler

Static
Jul 5th, 2006, 08:29 AM
you should be able to run that in an office app.. (like excel)
Just change the form_open to something else.... for testing

neoxavier
Jul 5th, 2006, 08:49 AM
ok thank a lot its help me a lot.. can u also tell me the syntax wether the internet connection is available or not..
thanks for the help

btw if i compile and run it from excel.. if its possible to make it run at start up so the program will listen to internet availability until it run other task..

thanks

Static
Jul 5th, 2006, 09:08 AM
you can really "compile" and run from excel..
I just told u that so u can test it...

u will need VB to compile it to an exe...

as far as the internet.. you'll have to ping a server or something to test for the connection..

neoxavier
Jul 5th, 2006, 09:10 AM
ah ok then