Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automate exiting of Outlook

Status
Not open for further replies.

mygmat123

Technical User
Jun 28, 2004
56
US
I would like to write code to quit OUTLOOK that is opened manually, then backup the .pst file. Is this possible?

What would the code look like? Thank you in advance!

 
It might help readers if you added some of your code to your post. Would this work?

Code:
olApp.Quit 'Your Outlook.Application variable
Set olApp = Nothing
FileCopy "location\filename", "copylocation\copyname"
 
Do you need an orderly exit or simply a Kill?

If your application is dealing with a manually started Outlook, then it would have to find that copy of Outlook and either SendKeys to exit it, or call APIs (best solution) to access it and exit it, or simply Kill it.

Which part do you need help with?
 
You may consider the GetObject("Outlook.Application") function to automate the manually opened session.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Dimandja,

your exactly correct, I need code to find that copy/all copies of outlook currntly open then use api to access and exit it. But I never really learned how to use APIs , How would it be coded?

PHV,
how would the getobject() work?

Thank you all for your help.
 
No F1 key on your keyboard ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Of course, f1, what are you recommending? The code needs to run at a scheduled time everynight, so it's not a matter of just finding another way to quit the program. See in order for some of our backups to work, Outlook need to be closed, but a lot of people here forget to exit it, so I thought, if I could code something to exit for them before the backup, then everything work work fine.


 
Of course, f1, what are you recommending
To use it when in VBE the cursor is on GetObject written either in immediate pane (Ctrl-G) or in a code module.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have reviewed the code you both recommended, and I'm not familiar enough with it. I was hoping for a simple script, but I see I'll have to spend some time learning about the getobject function and api calls with send keys.
If you happen to know how to adapt code to fit my needs, please post it. in the mean time I'll start learning the code you've recommended.

Thank you all once again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top