有些情況下,我們忘記取消我們計劃的會議,可能是由於缺少重要人物,或者可能是由於時間不夠。但在很多情況下,我們忘記從展望中取消會議。因此,我正在尋找一個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