Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Close ms outlook
Message
 
 
To
06/05/2005 10:26:30
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01011574
Message ID:
01011676
Views:
16
Keep in mind that TRY...ENDTRY in that form will "eat" any error not just the one caused by Otlook not running.

>That was too easy, Sergey. :) That's what I get for thinking too hard, sometimes.
>
>Thanks,
>
>Jim
>
>>Hi Jim,
>>
>>
>>You can use TRY...ENDTRY to catch and ignore the error. See corrections in your code below.
>>
>>>
>>>This is a minor thing I'm working on, but I have users on my network that leave outlook open and mess up my backup of their pst files located on a network share. I wanted to make a small exe that could be put in the scheduled tasks on each workstation, just before the backup time would close outlook, if it is running.
>>>
>>>This works when there's an existing instance of outlook running. It dies when there is not one. Is there a way to determine if the program is running or not?
>>>
>>>
>>>Public oOutLook, cVarType,oNameSpace,oInBox
>>>_screen.Visible = .F.
>>TRY
>>>oOutLook = Getobject(,"Outlook.Application")
>>>If Vartype(oOutLook) == 'O'
>>>	oNameSpace = oOutLook.GetNameSpace("MAPI")
>>>	oInBox = oNameSpace.GetDefaultFolder(6)	&& 10 = contacts, 6 = inbox, 5 = sent items
>>>	oInbox.Display()
>>>	oOutLook.Quit()
>>>	Release oOutLook
>>>Endif
>>CATCH
>>ENDTRY
>>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform