Outlook2010のVBAで承認した会議開催通知に対してキャンセルがあった場合、自動的に予定表から削除をしたいと考えています。
以下のコードを書いてみたのですが・・・思った通りの挙動(予定表からの削除)にならないため詳しい方教えて頂けませんでしょうか?
Public Sub DisplaySubjectByRule2(ByRef objItem As MeetingItem)
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim oAppt As AppointmentItem
Dim oResponse
Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection
For Each currentItem In Selection
If currentItem.MessageClass = "IPM.Schedule.Meeting.Request" Then
Set oAppt = currentItem.GetAssociatedAppointment(True)
If oAppt.ResponseRequested Then
Set oResponse = oAppt.Respond(olMeetingDeclined, True, False)
oResponse.Delete
Else
Set oResponse = oAppt.Respond(olMeetingDeclined, True, False)
End If
currentItem.Delete
ElseIf currentItem.MessageClass = "IPM.Schedule.Meeting.Canceled" Then
'ElseIf currentItem.MessageClass = "IPM.Schedule.Meeting.Neg" Then
Set oAppt = currentItem.GetAssociatedAppointment(True)
If oAppt Is Nothing Then
currentItem.Delete
End If
ElseIf currentItem.MessageClass = "IPM.Note" Then
currentItem.Delete
End If
Next
End Sub
あなたの回答
tips
プレビュー