如何從 Excel 資料建立約會?
假設您在 Excel 工作表中有一張如以下截圖所示的約會資料表,現在想將這些資料快速匯入行事曆,該如何操作?

使用 VBA 程式碼從 Excel 資料建立約會
若要從 Excel 資料建立約會,您可以套用下列 VBA 程式碼,請依下列步驟操作:
1. 啟動 Outlook,並按住 ALT + F11 鍵,即可開啟 Microsoft Visual Basic for Applications 視窗。
2. 點選插入> 模組,並將下列程式碼貼到模組視窗中。
VBA 程式碼:將 Excel 資料匯入約會:
Public Sub CreateOutlookApptz()
Dim xAppointmentItem As Outlook.AppointmentItem
Dim xNameSpace As Outlook.NameSpace
Dim xCalendarFld As Outlook.MAPIFolder, xSubFolder As Outlook.MAPIFolder
Dim xCalendarStr As String
Dim I As Long
Dim xFileDialog As FileDialog
Dim xFilePath As String
Dim xExcelApp As Excel.Application
Dim xWb As Workbook
Dim xWs As Worksheet
On Error GoTo Err_Execute
Set xExcelApp = New Excel.Application
Set xFileDialog = xExcelApp.FileDialog(msoFileDialogFilePicker)
With xFileDialog
.Title = "Select a file"
.Filters.Add "Microsoft Excel", "*.xlsx"
End With
If xFileDialog.Show = 0 Then Exit Sub
xFilePath = xFileDialog.SelectedItems(1)
Set xWb = xExcelApp.Workbooks.Open(xFilePath)
Set xNameSpace = Outlook.Application.Session
Set xCalendarFld = xNameSpace.GetDefaultFolder(olFolderCalendar)
I = 2
Set xWs = xWb.Worksheets.Item(1)
xCalendarStr = xWb.Name
If FolderExist(xCalendarFld, xCalendarStr) = False Then
Set xSubFolder = xCalendarFld.Folders.Add(xCalendarStr, olFolderCalendar)
Else
Set xSubFolder = xCalendarFld.Folders(xCalendarStr)
End If
Do Until Trim(xWs.Cells(I, 1).Value) = ""
Set xAppointmentItem = xSubFolder.Items.Add(olAppointmentItem)
With xAppointmentItem
.Start = xWs.Cells(I, 5) + xWs.Cells(I, 6)
.End = xWs.Cells(I, 7) + xWs.Cells(I, 8)
.Subject = xWs.Cells(I, 1)
.Location = xWs.Cells(I, 2)
.Body = xWs.Cells(I, 3)
.BusyStatus = olBusy
.ReminderMinutesBeforeStart = xWs.Cells(I, 9)
.ReminderSet = True
.Categories = xWs.Cells(I, 4)
.Save
End With
I = I + 1
Loop
Set xAppointmentItem = Nothing
Set olApp = Nothing
xExcelApp.Quit
Set xExcelApp = Nothing
MsgBox "Import successfully!", vbInformation, "Kutools for Outlook"
Exit Sub
Err_Execute:
MsgBox "An error occurred - Exporting items to Calendar.", vbInformation, "Kutools for Outlook"
End Sub
Function FolderExist(CalFolder As Folder, FolderName As String) As Boolean
Dim I As Integer
Dim xSubFolder As Folder
For I = 1 To CalFolder.Folders.Count
Set xSubFolder = CalFolder.Folders.Item(I)
If xSubFolder.Name = FolderName Then
FolderExist = True
Exit Function
End If
Next I
End Function
3. 仍在 Microsoft Visual Basic for Applications 視窗中,按一下工具> 參考項目 以開啟 參考項目 - Project 1 對話方塊,並從 Microsoft Excel 物件庫清單中勾選可用參考項目,如下圖所示:

4. 然後按一下確定按鈕,接著按下 F5 鍵執行此程式碼,此時會顯示選取檔案視窗,請選擇您要匯入 Outlook 的 Excel 檔案,如下圖所示:

5. 接著點擊確定,隨即彈出如下提示方塊:

6. 然後按一下確定,Excel 資料已匯入行事曆,如下圖所示:

Outlook 中的 AI 郵件助理:聰明回覆、清晰溝通,一鍵輕鬆搞定!
透過 Kutools for Outlook 的 AI 郵件助理,輕鬆簡化您每日的 Outlook 工作!這款強大工具能學習您過往的郵件內容,提供智慧又精準的回覆建議、優化郵件文字,並協助您毫不費力地起草與潤飾訊息。

此功能支援:
- 智慧回覆:根據您過往的對話,量身打造精準到位的回應,立即可用。
- 內容強化:自動優化您的郵件文字,提升清晰度與影響力。
- 輕鬆撰寫:只需提供關鍵字,其餘交給 AI 處理,並支援多種潤色風格。
- 智慧擴充:根據上下文提供貼心建議,延伸您的創意與想法。
- 摘要功能:立即獲取長篇郵件的簡明摘要。
- 全球溝通:輕鬆將郵件翻譯成任何語言。
此功能支援:
- 智慧郵件回覆
- 優化內容
- 關鍵字草稿
- 智慧內容擴充
- 郵件摘要
- 多語言翻譯
別再等待——立即下載 AI 郵件助理,盡情享受!
最佳 Office 生產力工具
體驗全新 Kutools for Outlook,內含 100+ 項超強功能!立即點擊下載!
🤖KUTOOLS AI:運用先進 AI 技術,輕鬆處理電子郵件——無論是回覆、摘要、優化、擴充、翻譯還是撰寫郵件,通通一鍵搞定!
📧 郵件自動化:自動答覆(支援 POP 與 IMAP)/預約寄送郵件/寄信時依規則自動抄送密送/自動轉發(高級規則)/自動加入問候語/自動將多收件人郵件拆分為個別訊息……
📨 郵件管理:撤回郵件/依主旨等條件封鎖詐騙郵件/刪除重複郵件/高級搜尋/整合文件夾……
📁 附件專業版:批次儲存/批次解除附加/批次壓縮/自動保存/自動拆離/自動壓縮……
🌟 介面魔法:😊更多精美酷炫表情符號/重要郵件來到時提醒您/最小化 Outlook 而非關閉……
👍 一鍵奇蹟:帶附件全部答復/防釣魚郵件/🕘顯示發送者當前時間時區……
👩🏼🤝👩🏻 聯絡人與行事曆:從選取的郵件中批次新增聯絡人/將聯繫人組拆分為個別群組/移除生日提醒……
用您的慣用語言暢享 Kutools — 完整支援英文、西班牙文、德文、法文、中文等 40 多種語言!
立即一鍵解鎖 Kutools for Outlook!別再等待,馬上下載,全面提升工作效率!


🚀 一鍵下載 — 立即取得所有 Office 增益集
強烈推薦:Kutools for Office(5 合 1)
一鍵下載五個安裝程式,一次完成 — Kutools for Excel、Outlook、Word、PowerPoint 與 Office Tab Pro!立即點擊下載!
- ✅ 一鍵便利:只需一次操作,即可下載全部五個安裝套件!
- 🚀 隨時應對任何 Office 任務:按需安裝所需增益集,立即提升工作效率!
- 🧰 包含:Kutools for Excel/Kutools for Outlook/Kutools for Word/Office Tab Pro/Kutools for PowerPoint