Using this small piece of Visual Basic for Applications code in Microsoft Outlook you can check the status of the out of office assistant. Normally I call this on the Item_Send evet. Which is a handy reminder to switch of your out of office assistant after your nice long holiday etc.

Public Sub checkoof()  Dim oCDO As MAPI.Session  Dim oStore As MAPI.InfoStore  Dim oFolder As MAPI.Folder  Dim strStoreID As String  Dim blnOOF As Boolean  Dim blnResult As Boolean Set oCDO = CreateObject("MAPI.Session")  oCDO.Logon "", "", False, False 'piggy-back logon  Set oFolder = oCDO.Inbox 'get default Inbox  strStoreID = oFolder.StoreID 'get default InfoStore.StoreID0  Set oStore = oCDO.GetInfoStore(strStoreID) 'get store  blnOOF = oStore.Fields(&H661D000B) 'get property  If blnOOF = True Then  blnResult = MsgBox("The out of office assistant is currently set, would you like to disable this?")  If blnResult = True Then  SendKeys "%{U}"  End If  End If  End Sub  Private Sub Application_Startup()  checkoof  End Sub  Public Sub checkoof()Dim oCDO As MAPI.SessionDim oStore As MAPI.InfoStoreDim oFolder As MAPI.FolderDim strStoreID As StringDim blnOOF As BooleanDim blnResult As Boolean Set oCDO = CreateObject("MAPI.Session")oCDO.Logon "", "", False, False 'piggy-back logonSet oFolder = oCDO.Inbox 'get default InboxstrStoreID = oFolder.StoreID 'get default InfoStore.StoreID0Set oStore = oCDO.GetInfoStore(strStoreID) 'get storeblnOOF = oStore.Fields(&H661D000B) 'get property  If blnOOF = True ThenblnResult = MsgBox("The out of office assistant is currently set, would you like to disable this?")If blnResult = True ThenSendKeys "%{U}"End IfEnd If  End Sub  Private Sub Application_Startup()  checkoof  End Sub
Tagged with:  

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!