使用VBA创建代码以在退出Outlook时打开“是/否”框,我可以将其打开“办公室外”功能,但无法使其运行。
我在Office 365上
尝试运行以下代码
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
错误消息是错误424对象必需