KutoolsforOffice — 一套方案,五大工具。事半功倍。

Outlook:如何以會議主辦人身分取消會議,卻仍將其保留在行事曆中?

作者Sun修改日期

在 Outlook 中,身為會議組織者,當您取消會議時,該會議會自動從行事曆中移除。然而,在某些情況下,您可能希望將已取消的會議保留在行事曆中以便標記或參考。可惜的是,Outlook 本身並未內建支援此需求的功能。本教學提供兩段 VBA 程式碼,讓您在取消會議時,仍能將其保留為行事曆中的預約項目。

用於將已取消會議複製為預約項目的 VBA 程式碼


用於將已取消會議複製為預約項目的 VBA 程式碼

以下是兩段程式碼,可在取消會議的同時,將其複製並貼上為預約項目。

注意:啟用程式碼前,請確認已勾選以下兩個選項:

啟動 Outlook,按一下檔案選項。在 Outlook 選項視窗中,按一下信任中心索引標籤,再點選信任中心設定。於信任中心視窗中,切換至巨集設定索引標籤,並勾選以下兩個選項:啟用所有巨集(不建議;可能執行危險程式碼)以及將巨集安全性設定套用至已安裝的增益集。完成後,按一下確定 確定 關閉所有視窗,並重新啟動Outlook。

文件保留行事曆中的會議 1
文件保留行事曆中的會議 2

1. 切換至行事曆檢視,選取您要取消的會議,然後按下 AltF11 鍵,即可開啟 Microsoft Visual Basic for Applications 視窗。

2. 按一下插入模組,即可插入新的空白模組!接著將下方程式碼複製並貼上至該模組中。

程式碼:將會議複製為預約項目並予以取消

Sub CopyMeetingAsAppointmentBeforeCancel()
'UpdatebyExtendoffice20221129
Dim xAppointmentItem As AppointmentItem
Dim xMeetingItem As AppointmentItem
On Error Resume Next
Set xMeetingItem = GetCurrentItem()
Set xAppointmentItem = Application.CreateItem(olAppointmentItem)
With xAppointmentItem
  .Subject = "Canceled: " & xMeetingItem.Subject
  .Start = xMeetingItem.Start
  .Duration = xMeetingItem.Duration
  .Location = xMeetingItem.Location
  .Body = xMeetingItem.Body
  .Save
  .Move Application.ActiveExplorer.CurrentFolder
End With
With xMeetingItem
  .MeetingStatus = olMeetingCanceled
  .Send
  .Delete
End With
Set xAppointmentItem = Nothing
Set xMeetingItem = Nothing
End Sub

Function GetCurrentItem() As Object
  On Error Resume Next
  Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
      Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
      Set GetCurrentItem = Application.ActiveInspector.CurrentItem
  End Select
End Function
文件保留行事曆中的會議 3

3. 按一下執行按鈕,或按下 F5 鍵,所選會議將被取消,並產生一個名為「Cancled & subjet」的約會。

文件保留行事曆中的會議 4

若您希望先將會議複製並貼上為另一個行事曆中的預約項目,再取消原會議,請使用下方程式碼:

程式碼:將會議複製為另一個行事曆中的預約項目並予以取消

Sub CopyMeetingAsAppointmentToCalenderBeforeCancel()
'Updatebyextendoffice20221129
Dim xDestCalendar As Outlook.MAPIFolder
Dim xNameSpace As Outlook.NameSpace
Dim xAppointmentItem As AppointmentItem
Dim xMeetingItem As AppointmentItem
On Error Resume Next
Set xNameSpace = Application.GetNamespace("MAPI")
Set xDestCalendar = xNameSpace.PickFolder
If xDestCalendar.DefaultItemType <> olAppointmentItem Then
  MsgBox "Please Select calendar folder. ", vbOKOnly + vbInformation, "Kutools for Outlook"
  Exit Sub
End If
Set xMeetingItem = GetCurrentItem()
Set xAppointmentItem = Application.CreateItem(olAppointmentItem)
With xAppointmentItem
  .Subject = "Canceled: " & xMeetingItem.Subject
  .Start = xMeetingItem.Start
  .Duration = xMeetingItem.Duration
  .Location = xMeetingItem.Location
  .Body = xMeetingItem.Body
  .Save
  .Move xDestCalendar
End With
With xMeetingItem
  .MeetingStatus = olMeetingCanceled
  .Send
  .Delete
End With
Set xDestCalendar = Nothing
Set xNameSpace = Nothing
Set xAppointmentItem = Nothing
Set xMeetingItem = Nothing
End Sub

Function GetCurrentItem() As Object
  On Error Resume Next
  Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
      Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
      Set GetCurrentItem = Application.ActiveInspector.CurrentItem
  End Select
End Function

按一下執行按鈕,或按下 F5 鍵,系統將彈出「選取資料夾」對話方塊,供您選擇要貼上預約項目的行事曆資料夾,再點選「確定」即可完成設定!

文件保留行事曆中的會議 5

現在,該會議已取消,並已複製為您所選行事曆資料夾中的預約項目。

文件保留行事曆中的會議 6

最佳 Office 生產力工具

體驗全新 Kutools for Outlook,內含 100+ 項超強功能!立即點擊下載!

🤖KUTOOLS AI運用先進 AI 技術,輕鬆處理電子郵件——無論是回覆、摘要、優化、擴充、翻譯還是撰寫郵件,通通一鍵搞定!

📧 郵件自動化自動答覆(支援 POP 與 IMAP)預約寄送郵件寄信時依規則自動抄送密送自動轉發(高級規則)自動加入問候語自動將多收件人郵件拆分為個別訊息……

📨 郵件管理撤回郵件依主旨等條件封鎖詐騙郵件刪除重複郵件高級搜尋整合文件夾……

📁 附件專業版批次儲存批次解除附加批次壓縮自動保存自動拆離自動壓縮……

🌟 介面魔法😊更多精美酷炫表情符號重要郵件來到時提醒您最小化 Outlook 而非關閉……

👍 一鍵奇蹟帶附件全部答復防釣魚郵件🕘顯示發送者當前時間時區……

👩🏼‍🤝‍👩🏻 聯絡人與行事曆從選取的郵件中批次新增聯絡人將聯繫人組拆分為個別群組移除生日提醒……

用您的慣用語言暢享 Kutools — 完整支援英文、西班牙文、德文、法文、中文等 40 多種語言!

立即一鍵解鎖 Kutools for Outlook!別再等待,馬上下載,全面提升工作效率!

kutools for outlook features1kutools for outlook features2

🚀 一鍵下載 — 立即取得所有 Office 增益集

強烈推薦:Kutools for Office(5 合 1)

一鍵下載五個安裝程式,一次完成 — Kutools for Excel、Outlook、Word、PowerPointOffice Tab Pro立即點擊下載!

  • 一鍵便利:只需一次操作,即可下載全部五個安裝套件!
  • 🚀 隨時應對任何 Office 任務:按需安裝所需增益集,立即提升工作效率!
  • 🧰 包含:Kutools for Excel/Kutools for Outlook/Kutools for Word/Office Tab Pro/Kutools for PowerPoint