Experts Exchange connects you with the people and services you need so you can get back to work.
'Add Tools->References->"Microsoft Outlook nn.n Object Library"
'nn.n varies as per our Outlook Installation
Dim Folder As Outlook.MAPIFolder
Dim iRow As Integer
'Mailbox or PST Main Folder Name (As how it is displayed in your Outlook Session)
MailBoxName = "MailBox Name"
'Mailbox Folder or PST Folder Name (As how it is displayed in your Outlook Session)
Pst_Folder_Name = "Folder Name" 'Sample "Inbox" or "Sent Items"
Set Folder = Outlook.Session.Folders(MailBoxName).Folders(Pst_Folder_Name)
If Folder = "" Then
MsgBox "Invalid Data in Input"
'Rad Through each Mail and export the details to Excel
For iRow = 1 To Folder.Items.Count
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).Size
'Sheets(1).Cells(iRow, 5) = Folder.Items.Item(iRow).SenderEmailAddress
'Sheets(1).Cells(iRow, 6) = Folder.Items.Item(iRow).Body
MsgBox "Outlook Mails Extracted to Excel"
Open in new window
Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!
Public BoolRange As Range
Public DateRange As Range
Public WithEvents TheMail As Outlook.MailItem
Private Sub TheMail_Send(Cancel As Boolean)
If Not BoolRange Is Nothing Then
BoolRange.Value = True
If Not DateRange Is Nothing Then
DateRange.Value = Now()
.To = addr
.Subject = "CCAT eVSM Utilities License Code"
.Body = "Message body"
Set CurrWatcher = New EmailWatcher
Set CurrWatcher.BoolRange = Range("G12")
Set CurrWatcher.TheMail = oMail
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment