Using ShellExecute to run OutLook once only

smig

Registered User.
Local time
Today, 18:59
Joined
Nov 25, 2009
Messages
2,209
I'm using ShellExecute to run OutLook.

what parameter should be changed in the ShellExecute function to make it run OutLook once only ?
 
Check for the existence of a running instance of Outlook first.
The following will throw an error if no instance of Outlook is found. If an error is thrown, run ShellExecute to start Outlook and set your Outlook object variable.

On error resume next 'Ignore error if one is thrown
Set objOutlook = GetObject(, "OUTLOOK.APPLICATION")

If ERR.Number <> 0 Then 'No instance of Outlook found
Set objOutlook = 'Insert your ShellExecute code here
End If
on error goto 0 'Reset error handling
 
Thank you

seems like a dirty way to do the task :D
 

Users who are viewing this thread

Back
Top Bottom