Set objOutlook = CreateObject("Outlook.Application")
objOutlook.GetNamespace("MAPI").Folders.GetFirst.GetExplorer.CommandBars.FindControl(, 5613).Execute
Set objOutlook = Nothing
Computer, Technology, Databases, Google, Internet, Mobile, Linux, Microsoft, Open Source, Security, Social Media, Web Development, Business, Finance
Search This Blog
Google Analytics
Thursday, October 29, 2009
How to set "Work Offline" for Outlook programatically
The show VBScript code snipppet will toggle between working "Offline" and "Online" for MS Outlook.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
新加坡人口400万,亚洲人口4亿,全世界人口6亿。 但是,我一人可能就很有可能是世界最傻的了。我真是个不折不扣的大木头。真是受不了自己。
-
If you live in the North-East and commute early, your daily transit routine just got a whole lot sweeter. The Land Transport Authority (LTA)...
-
Google url shortener service, goo.gl , is now much improved with newly included features like easier copy and paste, and ability to delete e...
-
Let’s be honest - Singapore isn't short on places to check the haze or PSI. Between official portals and various weather apps, the data ...
-
Just yesterday, popular food blogger, Brad Lau, who owns food blog ladyironchef , who had refused to pay the full cost of his 4-persons meal...
My goal was to be able to create a special Outlook Rule that evaluated the subject line of a message, and if it met my criteria would take Outlook offline. I use this when I'm away from my office and forget to take outlook offline, so that it is not picking up my messages from the server while I'm out, leaving them unread on the server for use on my mobile devices.
ReplyDeleteI found your script while searching for VBS to take outlook offline, and it worked great, except that it would open a new window when executed.
For others wishing to do this... After a bit more investigation and code hacking, this solution worked for me, taking OL offline using the active window. Immediately upon receipt it takes outlook offline, and you may receive a benign error in the status bar saying that the send/receive was interrupted (because, essentially it was, by the script):
Dim oOL
Set oOL = GetObject(, "Outlook.Application")
If Not (oOL Is Nothing) Then
Set objCBs = oOl.Application.ActiveExplorer.CommandBars
objCBs.FindControl(, 5613).Execute
End If
Set oOL = Nothing