|
-
Jul 18th, 2000, 02:28 PM
#1
Thread Starter
New Member
Does anyone know of a way to close Outlook via a VB program?
I wrote a clumsy program which opens Outlook and sends keys to exit and log off, but there are too many situation the sendkeys routine doesn't work. I am looking at backup solutions for our company and one of the big problems is most backup programs cannot back up open files. Outlook's .pst files are the most important files for us to be able to back up but if a user leaves Outlook open, the .pst file won't be backed up.
Any help would be appreciated.
Thanks,
[email protected]
-
Jul 18th, 2000, 02:31 PM
#2
So Unbanned
Try the Kill command it works great for M$ programs.
-
Jul 18th, 2000, 05:11 PM
#3
Thread Starter
New Member
Isn't Kill for deleting files? I'm looking to close Outlook, not to delete any files.
-
Jul 18th, 2000, 06:48 PM
#4
Try sending this to outlook
Hope this helps
-
Jul 18th, 2000, 11:04 PM
#5
Lively Member
This works with Outlook 2000. Not sure if Outlook 97/98 has an object model you can hook into.
Code:
Dim Outlook As Object
On Error Resume Next
'Set will error if outlook isnt running. So Outlook will be nothing
Set Outlook = GetObject(, "Outlook.Application")
If Outlook Is Nothing Then
Outlook.Quit
Set Outlook = Nothing
End If
-
Jul 19th, 2000, 09:49 AM
#6
Thread Starter
New Member
Thanks Ruxpin! The code you gave didn't quite work but it was close enough that I was able to figure it out. Here's what worked:
Option Explicit
Dim Outlook As Object
Private Sub Form_Load()
On Error Resume Next
'Set will error if outlook isnt running. So
'Outlook will be nothing
Set Outlook = GetObject(, "Outlook.Application")
If Outlook Is Nothing Then End
Outlook.Quit
Set Outlook = Nothing
End
End Sub
-
Jul 19th, 2000, 04:28 PM
#7
Lively Member
Wooops yeah sorry, was supposed to be
Code:
If Not Outlook Is Nothing Then
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|