自动拒绝会议邀请运行时错误 91:未设置对象变量或块变量 [英] Auto-Decline Meeting Invite Run-Time Error 91: Object variable or With block variable not set

查看:71
本文介绍了自动拒绝会议邀请运行时错误 91:未设置对象变量或块变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在多个位置找到了自动拒绝会议请求的代码.

I found the code for Auto-Decline a meeting request in several locations.

在我的 Outlook 2013 中,作为规则操作,它停在旨在丢弃而不是发送回复的行上.

In my Outlook 2013 as an action for a rule, it is stopping on the line intended to discard instead of sending the reply.

会议组织者不需要每个人的回应.因为它在小组日历上,所以我个人不需要它,因为它们不是我参与的会议.

The meeting organizer does not need a response from everyone. As it is on the group calendar, I don't need it on my personal as they are not meetings I get involved with.

Outlook 规则在遇到运行时错误时会中止脚本并在执行几个附加操作(标记为读取和删除)之前跳出.

The Outlook rule is aborting the script and jumping out before a couple of additional actions (mark as read and delete) when it hits the Run-time error.

这导致邀请留在我的收件箱中,我不知道向组织者发送垃圾邮件是什么.

This is resulting in the invite remaining in my Inbox and I don't know what with spamming the organizer.

Sub AutoDeclineMeetings(oRequest As MeetingItem)

If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
    Exit Sub
End If

Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(False)

Dim oResponse
Set oResponse = oAppt.Respond(olMeetingDeclined, True)
oResponse.Close (olDiscard)

'These actions I added for my rule to discard the invite from the inbox.
oRequest.UnRead = False
oRequest.Delete

End Sub

在线oResponse.Close (olDiscard) 我正在接收

运行时错误 91:对象变量或未设置块变量.

Run-Time error 91: Object variable or With block variable not set.

我创建了一个用于测试的临时宏,它采用 Outlook 中当前选择的会议邀请,并将其提供给 AutoDecline 脚本.这就是我显示错误的方式.

I created a temporary macro for testing that takes the currently selected meeting invite in Outlook, and feeds it into the AutoDecline script. This is how I get the error to show itself.

Sub TestMacro()

Dim TestItem As MeetingItem
Set TestItem = ActiveExplorer.Selection.Item(1)
Call AutoDeclineMeetings(TestItem)

End Sub

我希望拒绝响应被丢弃,而不是发送给会议发起人,因此我不会向他们发送垃圾邮件.

I am expecting the Decline response to be discarded instead of being sent to the meeting originator so I don't spam them.

推荐答案

如果不需要响应,我认为您不需要对响应执行任何操作.我相信您收到错误是因为您试图在未打开时关闭响应窗口.您可以尝试更改以下行以查看它是否消除了错误:

I don't think you need to do anything with the response if no response is needed. I believe you are getting the error because you are trying to close the response window when it's not open. You could try changing the following line just to see if it gets rid of the error:

Set oResponse = oAppt.Respond(olMeetingDeclined, False, True)

我有类似的宏,如果没有请求响应,我就不会做任何事情.例如:

I have similar macros and I simply don't do anything if no response is requested. For example:

Set oResponse = oAppt.Respond(olMeetingDeclined, True)
If oAppt.ResponseRequested Then
    oResponse.Send
End If

oRequest.UnRead = False
oRequest.Delete

这篇关于自动拒绝会议邀请运行时错误 91:未设置对象变量或块变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆