Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Javascript to close Outlook, then wait a few seconds, and then reopen outlook

Hi

I have a very difficult user who never shuts down his outlook, and when he comes in, in the morning, finds out that his Outlook does not work properly.  The solution that I have come up with is to automatically shut down his Outlook for him.  I already have a script to do that (see attached code).  But now he complains that he has to manually open up outlook again, so I was wondering if anyone knew what I can add to allow my code to run, then wait 5 seconds, and then open up outlook again. Any help will be appreciated.
Dim oOL As Outlook.Application
Set oOL = GetObject(, "Outlook.Application")
If oOL Is Nothing Then
    'no need to do anything, Outlook is not running
Else
    'Outlook running
    For i = oOL.Inspectors.count To 1 Step -1
        oOL.Inspectors.Item(i).CurrentItem.Save
        oOL.Inspectors.Item(i).Close True
    Next
    oOL.Session.Logoff
    oOL.Quit
End If
Set oOL = Nothing

Open in new window

0
NerishaB
Asked:
NerishaB
1 Solution
 
boing40001Commented:
why don't you just schedule a new task that opens outlook ?
0
 
NerishaBAuthor Commented:
It's not in code form, but it is a solution to the problem.  Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now