我想出口我的電子郵件中搜索文件夾到Excel。出口Outlook 2013中搜索文件夾的郵件到Excel
我使用下面的代碼來導出我的電子郵件收件箱中。
但隨着搜索文件夾它給了我一個錯誤:
運行時錯誤「-2147221233(8004010F)
嘗試的操作失敗。找不到對象。
Sub Download_Outlook_Mail_To_Excel()
Dim folders As Outlook.folders
Dim folder As Outlook.MAPIFolder
Dim iRow As Integer
Dim Pst_Folder_Name
Dim MailboxName
MailboxName = "[email protected]"
Pst_Folder_Name = "Inbox"
Set folder = Outlook.Session.folders(MailboxName).folders(Pst_Folder_Name)
Sheets(1).Activate
For iRow = 1 To folder.Items.Count
Sheets(1).Cells(iRow, 1).Select
Sheets(1).Cells(iRow, 1) = folder.Items.Item(iRow).SenderName
Sheets(1).Cells(iRow, 2) = folder.Items.Item(iRow).Subject
Sheets(1).Cells(iRow, 3) = folder.Items.Item(iRow).ReceivedTime
Sheets(1).Cells(iRow, 4) = folder.Items.Item(iRow).Categories
Next iRow
MsgBox "Outlook Mails Extracted to Excel"
End Sub
什麼是你所得到的錯誤訊息? – moffeltje
嘗試的操作失敗。一個對象無法找到 – Erika
運行時錯誤「-2147221233(8004010F)」 – Erika