Hi,
I have been working on some VBA to allow me to just click a yes button to turn on my Out of Office when I quit outlook but I can't get it to work.
I'm on Office 365.
Code is as follows:
Private Sub Application_Quit()
Dim objMAPISession As Object
Set objReminders = Nothing
If MsgBox("Would you like to turn the Out of Office Assistant on?", vbYesNo, "Activate Out of Office Assistant") = vbYes Then
Set objMAPISession = CreateObject(“MAPI.Session”)
objMAPISession.Logon , , True, False
objMAPISession.OutOfOffice = True
objMAPISession.Logoff
End If
Set objMAPISession = Nothing
End Sub
Can anyone help fix my code for me?
Thanks
I have been working on some VBA to allow me to just click a yes button to turn on my Out of Office when I quit outlook but I can't get it to work.
I'm on Office 365.
Code is as follows:
Private Sub Application_Quit()
Dim objMAPISession As Object
Set objReminders = Nothing
If MsgBox("Would you like to turn the Out of Office Assistant on?", vbYesNo, "Activate Out of Office Assistant") = vbYes Then
Set objMAPISession = CreateObject(“MAPI.Session”)
objMAPISession.Logon , , True, False
objMAPISession.OutOfOffice = True
objMAPISession.Logoff
End If
Set objMAPISession = Nothing
End Sub
Can anyone help fix my code for me?
Thanks