如何在Outlook中分別向多位收件人發送日曆?
通常,您可以使用Outlook中的電子郵件日曆功能快速輕鬆地將日曆發送給一位收件人。如果您想將日曆作為iCalendar文件分別發送給多個聯絡人,則需要逐一發送。本文中,我將介紹一種簡單的方法,讓您可以在Outlook中分別向多位收件人發送日曆。
使用VBA代碼分別向多位收件人發送日曆
要分別向多位收件人發送日曆,以下VBA代碼可以幫助您,請按照以下步驟操作:
1. 轉到聯絡人窗格,並選擇您要發送日曆的聯絡人。
2. 然後按住 ALT + F11鍵打開 Microsoft Visual Basic for Applications窗口。
3. 點擊插入 > 模組,複製並將以下代碼粘貼到打開的空白模組中,參見截圖:
VBA代碼:分別向多位收件人發送日曆:
Sub EmailCalendarToMultiplePersonsSeparately()
Dim xSelection As Outlook.Selection
Dim xCalendarFolder As Outlook.Folder
Dim xCalendarExporter As Outlook.CalendarSharing
Dim xStartDate, xEndDate As Date
Dim xCalendarFile As String
Dim xContactItem As Outlook.ContactItem
Dim xDistListItem As Outlook.DistListItem
Dim xItem As Object
Dim xMailItem As Outlook.MailItem
Dim xFilePath, xFileName, xEmailAddress As String
Dim xRecipient As Recipient
On Error Resume Next
xFilePath = CreateObject("WScript.Shell").SpecialFolders(16) & "\MyCalendar"
If Dir(xFilePath, vbDirectory) = "" Then MkDir xFilePath
If Outlook.Application.ActiveExplorer.CurrentFolder.DefaultItemType <> olContactItem Then
MsgBox "Please Select contacts first!", vbExclamation + vbOKOnly, "Kutools for Outlook"
Exit Sub
End If
Set xSelection = Outlook.Application.ActiveExplorer.Selection
If xSelection Is Nothing Then Exit Sub
Set xCalendarFolder = Outlook.Application.Session.PickFolder
If xCalendarFolder Is Nothing Then Exit Sub
If xCalendarFolder.DefaultItemType <> olAppointmentItem Then Exit Sub
Set xCalendarExporter = xCalendarFolder.GetCalendarExporter
xStartDate = InputBox("Enter the start date:", "Kutools for Outlook", "")
If Len(Trim(xStartDate)) = 0 Then Exit Sub
xEndDate = InputBox("Enter the end date:", "Kutools for Outlook", "")
If Len(Trim(xEndDate)) = 0 Then Exit Sub
If xStartDate = #1/1/4501# Or xEndDate = #1/1/4501# Then Exit Sub
xFileName = "Calendar (" & Format(xStartDate, "YYYYMMDD") & " - " & Format(xEndDate, "YYYYMMDD") & ").ics"
xCalendarFile = xFilePath & "\" & xFileName
With xCalendarExporter
.IncludeWholeCalendar = False
.StartDate = xStartDate
.EndDate = xEndDate
.CalendarDetail = olFullDetails
.IncludeAttachments = True
.IncludePrivateDetails = False
.RestrictToWorkingHours = False
.SaveAsICal xCalendarFile
End With
For Each xItem In xSelection
If xItem.Class = olContact Then
Set xContactItem = xItem
Set xMailItem = Outlook.Application.CreateItem(olMailItem)
With xMailItem
.To = xContactItem.Email1Address
.Recipients.ResolveAll
.Subject = xFileName
.Attachments.Add xCalendarFile
.Body = "Dear " & xContactItem.FullName & "," & vbCrLf & "Type body here..."
.Display
End With
End If
If xItem.Class = olDistributionList Then
Set xDistListItem = xItem
For i = 1 To xDistListItem.MemberCount
Set xRecipient = xDistListItem.GetMember(i)
Set xMailItem = Outlook.Application.CreateItem(olMailItem)
With xMailItem
.To = xRecipient.AddressEntry.Address
.Recipients.ResolveAll
.Subject = xFileName
.Attachments.Add xCalendarFile
.Body = "Dear " & xRecipient.Name & "," & vbCrLf & "Type body here..."
.Display
End With
Next i
End If
Next
End Sub

4. 插入代碼後,然後按F5鍵運行此代碼,彈出一個選擇文件夾對話框,請選擇您要發送的日曆,參見截圖:

5. 點擊確定,然後在以下提示框中指定您要發送日曆的日期範圍,參見截圖:

6. 然後,點擊確定,已創建帶有日曆附件的新郵件,如下截圖所示,然後您只需逐一發送它們即可。

相關文章:
最佳 Office 生產力工具
最新消息:Kutools for Outlook 推出免費版本!
體驗全新 Kutools for Outlook,擁有100+ 強大功能!立即下載!
🤖 Kutools AI :運用先進 AI 技術,輕鬆處理郵件,包括答覆、摘要、優化、擴寫、翻譯與撰寫郵件。
📧 郵件自動化:自動回覆(支援 POP 和 IMAP) / 計劃發送郵件 / 發送郵件時根據規則自動抄送密送 / 自動轉發(高級規則) / 自動新增問候語 / 自動將多收件人郵件分割為個別郵件 ...
📨 郵件管理:撤回郵件 /依主題等條件阻擋詐騙郵件 / 刪除重複郵件 / 高級搜索 / 整合文件夾 ...
📁 附件專業版:批次保存 / 批次拆離 / 批次壓縮 / 自動保存 / 自動拆離 / 自動壓縮 ...
🌟 介面魔法:😊更多精美酷炫表情符號 /重要郵件來臨提醒 / 最小化 Outlook 而非關閉 ...
👍 一鍵神技:帶附件全部答復 /反釣魚郵件 / 🕘顯示發件人時區 ...
👩🏼🤝👩🏻 聯絡人與日曆:批次從選中郵件新增聯絡人 / 將聯絡人組分割為多個組 / 移除生日提醒 ...
以您偏好的語言使用 Kutools —— 支援英語、西班牙語、德語、法語、中文及40 多種其他語言!
只需一鍵即可立即啟用 Kutools for Outlook。立即下載,提升您的效率!

