none
Looking for a way to control OL off-line status RRS feed

  • Question

  • I have tried:

    Set oOL = GetObject(, "Outlook.Application")
    Set objCBs = oOl.Application.ActiveExplorer.CommandBars
    objCBs.FindControl(, 5613).Execute
    Set oOL = Nothing

    This code DOES work, but after calling it Outlook does not exit correctly. It remains open in Task Manager. This behavior is present in both OL2003 and 2010, Win XP and Win7.

    I have tried calling the code from within OL VBA, VB6 and VBS all hang Outlook when it closes.

    Is there another way to programmatically take OL offline, or a way to get OL to close correctly after calling?
    Sunday, February 24, 2013 1:56 PM

Answers

  • Also, if you download Redemption, does the following script work for you?

      set Session = CreateObject("Redemption.RDOSession")
      Session.MAPIOBJECT = Application.Session.MAPIOBJECT
      Session.Offline = not Session.Offline


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Thursday, February 28, 2013 9:30 PM

All replies

  • Why do you call GetObject? In Outlook VBA, you can always the Application intrinsic variable.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Sunday, February 24, 2013 4:21 PM
  • I just posted my VB code. I tried it several ways but all hang outlook after calling
    objCBs.FindControl(, 5613).Execute

    Sunday, February 24, 2013 9:54 PM
  • Are you sure objCBs.FindControl returns a valid object?

    I am getting null in Outlook 2013.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Thursday, February 28, 2013 9:23 PM
  • Also, if you download Redemption, does the following script work for you?

      set Session = CreateObject("Redemption.RDOSession")
      Session.MAPIOBJECT = Application.Session.MAPIOBJECT
      Session.Offline = not Session.Offline


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Thursday, February 28, 2013 9:30 PM