有些情况下,我们忘记取消我们计划的会议,可能是由于缺少重要人物,或者可能是由于时间不够。但在很多情况下,我们忘记从展望中取消会议。因此,我正在寻找一个VBA代码,如果会议很好,或者要取消会议,会向组织者开会,如果要取消会发出取消邮件。请帮我解决一下这个。提前致谢! :)展望会议取消使用VBA
0
A
回答
2
利用@alina以及在网络上的其他一些宏的代码后,我想出了这我在这里共享同一个解决方案。
Public WithEvents objReminders As Outlook.Reminders
Sub Initialize_handler()
Set objReminders = Application.Reminders
End Sub
Private Sub objReminders_ReminderFire(ByVal ReminderObject As reminder)
Dim oApp As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oApptItem As Outlook.AppointmentItem
Dim oFolder As Outlook.MAPIFolder
Dim oMeetingoApptItem As Outlook.MeetingItem
Dim oObject As Object
Dim iUserReply As VbMsgBoxResult
Dim sErrorMessage As String
MsgBox (VBA.Time)
On Error Resume Next
' check if Outlook is running
Set oApp = GetObject("Outlook.Application")
If Err <> 0 Then
'if not running, start it
Set oApp = CreateObject("Outlook.Application")
End If
On Error GoTo Err_Handler
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(olFolderCalendar)
For Each oObject In oFolder.Items
If oObject.Class = olAppointment Then
Set oApptItem = oObject
If ReminderObject.Caption = oApptItem.Subject Then
If oApptItem.Organizer = Outlook.Session.CurrentUser Then
iUserReply = MsgBox("Meeting found:-" & vbCrLf & vbCrLf _
& Space(4) & "Date/time (duration): " & Format(oApptItem.Start, "dd/mm/yyyy hh:nn") _
& " (" & oApptItem.Duration & "mins)" & Space(10) & vbCrLf _
& Space(4) & "Subject: " & oApptItem.Subject & Space(10) & vbCrLf _
& Space(4) & "Location: " & oApptItem.Location & Space(10) & vbCrLf & vbCrLf _
& "Do you want to continue with the meeting?", vbYesNo + vbQuestion + vbDefaultButton1, "Meeting confirmation")
If iUserReply = vbNo Then
oApptItem.MeetingStatus = olMeetingCanceled
oApptItem.Save
oApptItem.Send
oApptItem.Delete
End If
End If
End If
End If
Next oObject
Set oApp = Nothing
Set oNameSpace = Nothing
Set oApptItem = Nothing
Set oFolder = Nothing
Set oObject = Nothing
Exit Sub
Err_Handler:
sErrorMessage = Err.Number & " " & Err.Description
End Sub
0
我发现这个here
Public Function DeleteAppointments(ByVal subjectStr As String)
Dim oOL As New Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oAppointments As Object
Dim oAppointmentItem As Outlook.AppointmentItem
Dim iReply As VbMsgBoxResult
Set oNS = oOL.GetNamespace("MAPI")
Set oAppointments = oNS.GetDefaultFolder(olFolderCalendar)
Count = oAppointments.Items.Count 'for test purposes
For Each oAppointmentItem In oAppointments.Items
If InStr(oAppointmentItem.Subject, subjectStr) > 0 Then
iReply = msgbox("Appointment found:" & vbCrLf & vbCrLf _
& Space(4) & "Date/time: " & Format(oAppointmentItem.Start, "dd/mm/yyyy hh:nn") & vbCrLf _
& Space(4) & "Subject: " & oAppointmentItem.Subject & Space(10) & vbCrLf & vbCrLf _
& "Delete this appointment?", vbYesNo + vbQuestion + vbDefaultButton2, "Delete Appointment?")
If iReply = vbYes Then oAppointmentItem.Delete
oAppointmentItem.Delete
End If
Next
Set oAppointmentItem = Nothing
Set oAppointments = Nothing
Set oNS = Nothing
Set oOL = Nothing
End Function
+0
谢谢你的代码。但我对此有一个疑问。请耐心等待,因为我对VBA是全新的。所以,疑问是,你怎么称这个宏?另外,你会在哪里给变量“subjectStr”的值,我猜这是在这种情况下的检查变量。 再次感谢您的代码! :) – raslams 2013-03-19 11:30:24
相关问题
- 1. 展望VBA会议调整
- 2. 展望VBA:使用Word检查创建的后续会议邀请
- 3. 展望在会议时间差
- 4. 展望会议和富文本格式
- 5. 展望VBA脚本不会运行
- 6. 展望VBA发送
- 7. VBA展望脚本
- 8. 展望VBA代码
- 9. 如何使用vcalendar取消Outlook会议?
- 10. 使用vba获取展望组织团队层次结构
- 11. 展望2016显示即使与EWS API创建会议
- 12. 展望简化我的VBA
- 13. 计数展望VBA附件
- 14. 自动接受展望VBA
- 15. 展望VBA的MailItem驼峰
- 16. 展望VBA代码弱点
- 17. 展望VBA Rule.Enabled不工作
- 18. VBA展望2010移动
- 19. 取消关闭展望形式区域
- 20. 出口展望日历会议和约会今天的日期
- 21. 展望回顾消息c#
- 22. 使用EWS提取会议
- 23. 展望powershell - 增加会议开始时间的时间?
- 24. 创建约会到特定日历。 VBA展望
- 25. Facebook的会议取消对话框
- 26. VBA - 展望:从多个邮箱中
- 27. 展望VBA - 设置sentonbehalf和刷新ActiveInspector
- 28. VBA展望身体字符串搜索
- 29. 弹出与选择框展望vba
- 30. 展望vba脚本停止工作
你已经试过了什么? – 2013-03-18 13:13:52
欢迎来到StackOverflow。卢卡指出的是,在我们这里,我们重视人们首先尝试自己想办法解决问题,然后提出一个关于他们所困扰的具体问题的问题。 – 2013-03-18 13:34:28
我对VBA完全陌生。我搜索了VBA代码,这将帮助我做同样的事情,但无济于事。我最接近的是一个代码,它将发送会议提醒。 – raslams 2013-03-19 13:19:25