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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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 |