I have a VBA application that is sending appointments to Outlook, but want to check if it's running in the background before I do so. My code below tells me if it's running but i can't find a property to give me what I want. Can anyone help please?
Thanks
Simon Rouse
Code:
Function Outlook_is_Running()
Dim MyOL As Object
On Error Resume Next ' Defer error trapping.
' Getobject function called without the first argument returns a
' reference to an instance of the application. If the application isn't
' running, an error occurs.
Set MyOL = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then
Outlook_is_Running = False
MyOL.Quit
Else
Outlook_is_Running = True
End If
Set MyOL = Nothing
End Function
Thanks
Simon Rouse