Hello, I am trying to export outlook emails to an excel spreadsheet.
I compiled and run the following code which executes very well:
On Error Resume Next
Dim emailcount As Integer
Dim OLF As Outlook.MAPIFolder
Dim ol As New Outlook.Application
'OLF is declared as mapi folder to decide'which folder you want to target
Set OLF = ol.Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail)
'OLF.Items.Count provide the number of mail present in inbox
emailcount = OLF.Items.Count
'by i=1 we 'are initializing the variable by value 1'else it will throw an error
i = 1
'Here I am using do while - loop to'Browse through all mail
Do While i <= emailcount
Sheet3.Cells(i + 1, 1) = OLF.Items(i).SenderEmailAddress
Sheet3.Cells(i + 1, 2) = OLF.Items(i).SenderName
Sheet3.Cells(i + 1, 3) = OLF.Items(i).SentOn
'Sheet3.Cells(i + 1, 4) = OLF.Items(i).Body
i = i + 1
Loop
'Like SenderEmailAddress SenderName SentOn'we can use other properties of email to get other 'details
Set OLF = Nothing
Set ol = Nothing
MsgBox " Export completed!"
I would like to schedule the execution of the macro with Windows Scheduler.
My concern is that, when the macro starts, I get the prompt to provide my OutLook Profile Name. Afterwards, I receive another prompt to provide Entrust username and password.
Is there any way to wrap security information (OutLook Profile Name, Entrust username and password) into the macro code?
Thanks in advance.
Joe
Bookmarks