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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Outlook to offline mode via VBA code

Status
Not open for further replies.

joemajestee

Programmer
May 5, 2010
35
US
Hi there.
Is there a way to make Outlook go into offline mode via VBA?

Background:
I'm sending stuff via Outlook from Excel using
Code:
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
...

I want to check if Outlook is online and set it to offline if online.
That allows user to scroll through a few in outlook outbox to verify the emails are as expected before sending.

Win 7, Office 2010

Thanks
 
If you whant to 'verify' before sending why not use .display rather than .send ???

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
There might be 100 emails to display. It's much easier and doesn't kill the computer memory if they just accumulate in the outbox. My normal process now is to go offline, run the macro, then look at a sample of the emails and go online. Invariably when I forgot to go offline first I find I've made some mistake in my email.
 
Figured it out. The following code in excel worked.

Code:
Sub ToggleOutlookOffline()
Dim OutApp As Object
Set OutApp = CreateObject("Outlook.Application")
MsgBox OutApp.session.offline
OutApp.GetNamespace("MAPI").Folders.GetFirst.GetExplorer.CommandBars.FindControl(, 5613).Execute
MsgBox OutApp.session.offline
Set OutApp = Nothing
End Sub

[URL unfurl="true"]http://www.outlookcode.com/threads.aspx?forumid=2&messageid=26448[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top