I do a backup of my hard drive every night. In order to back up the Outlook pst files properly, Outlook must be closed before the backup is initiated. So I wrote a routine to close Outlook and placed it in a vbs file. The code for the vbs file is
On Error Resume Next
Set Outlook = GetObject(, "Outlook.Application")
If Err = 0 Then
Outlook.Quit()
End If
The vbs file name is:
D:\Documents\Program Downloads\Install\Close Outlook\Works with Windows 10\CloseOutlook.vbs
I tested the vbs file by double clicking on it when Outlook is open and Outlook immediately closes so I know that the vbs file works.
I set up a task in Task Scheduler pointing to this file but Outlook does not close at the scheduled time. When I look at the Task Scheduler log it says:
The operation was cancelled by the user. (0x8000704C7).
Can someone help me figure out what is wrong? I have looked online for a solution to this but have been unable to find one. Why does it work manually, but not in the Task Scheduler?
On Error Resume Next
Set Outlook = GetObject(, "Outlook.Application")
If Err = 0 Then
Outlook.Quit()
End If
The vbs file name is:
D:\Documents\Program Downloads\Install\Close Outlook\Works with Windows 10\CloseOutlook.vbs
I tested the vbs file by double clicking on it when Outlook is open and Outlook immediately closes so I know that the vbs file works.
I set up a task in Task Scheduler pointing to this file but Outlook does not close at the scheduled time. When I look at the Task Scheduler log it says:
The operation was cancelled by the user. (0x8000704C7).
Can someone help me figure out what is wrong? I have looked online for a solution to this but have been unable to find one. Why does it work manually, but not in the Task Scheduler?