自动接受Outlook VBA

时间:2010-03-18 14:09:26

标签: vba outlook outlook-vba

是否有VB宏或某种附加组件允许我通过发件人或文件夹自动接受Outlook中的邀请?

我正在考虑为此做一个VB脚本,但我不想重新发明轮子?

1 个答案:

答案 0 :(得分:2)

我过去曾经使用过这个将这个子目录添加到VBA页面并连接你的规则,以便当你从certian发件人收到它并且会议邀请或更新时它会触发。

Sub AutoAccept(ByRef Item As Outlook.MeetingItem)

  Dim strID As String
  Dim olNS As Outlook.NameSpace
  Dim oMeetingItem As Outlook.MeetingItem
  Dim oResponse As Outlook.MeetingItem
  Dim oAppointment As Outlook.AppointmentItem

  strID = Item.EntryID

  Set olNS = Application.GetNamespace("MAPI")
  Set oMeetingItem = olNS.GetItemFromID(strID)
  Set oAppointment = oMeetingItem.GetAssociatedAppointment(True)

  Set oResponse = oAppointment.Respond(olMeetingAccepted)
  oResponse.Send

  oAppointment.Save
  oMeetingItem.Save


  Set oAppointment = Nothing
  Set oMeetingItem = Nothing
  Set olNS = Nothing

End Sub