Your technology certification is waiting. Enroll in Cloud Class ®
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()
Open in new window
.To = addr
.Subject = "CCAT eVSM Utilities License Code"
.Body = "Message body"
Set CurrWatcher = New EmailWatcher
Set CurrWatcher.BoolRange = Range("G12")
Set CurrWatcher.TheMail = oMail
This course will introduce you to C++ 11 and teach you about syntax fundamentals.
'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"
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
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.