ja1clark
04-20-2004, 11:53 AM
Decided to repost since I still do not have answer.
All I am trying to do is run some code if Outlook is running - if it is not do nothing.
The following code works fine when Outlook is running but fails when Outlook is not running (Object required 'MyOutlook.ActiveExplorer'). Can anyone see the solution?
Set WshShell = WScript.CreateObject("WScript.Shell")
Set MyOutlook = CreateObject("Outlook.Application")
If TypeName(MyOutlook) <> "Nothing" Then
MyOutlook.ActiveExplorer.Activate
Wscript.Sleep 200
WshShell.SendKeys "%Vgc"
Wscript.Sleep 200
WshShell.SendKeys "%Fg"
WshShell.SendKeys "%S"
WshShell.SendKeys "%Y"
Set MyOutlook = Nothing
Else
Set MyOutlook = Nothing
End If
Wscript.Quit
All I am trying to do is run some code if Outlook is running - if it is not do nothing.
The following code works fine when Outlook is running but fails when Outlook is not running (Object required 'MyOutlook.ActiveExplorer'). Can anyone see the solution?
Set WshShell = WScript.CreateObject("WScript.Shell")
Set MyOutlook = CreateObject("Outlook.Application")
If TypeName(MyOutlook) <> "Nothing" Then
MyOutlook.ActiveExplorer.Activate
Wscript.Sleep 200
WshShell.SendKeys "%Vgc"
Wscript.Sleep 200
WshShell.SendKeys "%Fg"
WshShell.SendKeys "%S"
WshShell.SendKeys "%Y"
Set MyOutlook = Nothing
Else
Set MyOutlook = Nothing
End If
Wscript.Quit