Hi,
I am a new to VBA. I am working on transferring my email messages to excel as well as its attachments when a date will be entered. I am hoping someone will be able to help me solve the problem since I've also copy this in the internet. I am encountering an error that says, " Run-time error 424 Object Required" under the line "Range("Email_Subject").offset(1,0).Value = OutlookMail.Subject". I am stuck to it. The code does not yet include how to extract the attachment (save it to Drive C:\Marl\) however I would be very grateful if you could also add the code about it. Here's the code --
Code
Dim olApp as Outlook.Application
Dim olNS as Outlook.Namespace
Dim olFldr as Outlook.MAPIFolder
Dim OlItms as Outlook.Items
Dim olMail as Variant
Dim 1 as Integer
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace ("MAPI")
Set OlFldr = olNS.Pickfolder
if olFldr = "Nothing" then Exit sub
Set olItms = olFldr.Items
i = 1
if olItms.ReceivedTime >= Range("B4").value then
Range("Email_Subject").offset(1,0).Value = OutlookMail.Subject
Range("Email_Date").offset(1,0).Value = Outlookmail.ReceivedTime
Range("Email_Sender").offset(1,0).Value = Outlookmail.SenderName
Range ("Email_Body").offset(1,0).Value = Outlookmail.body
i = 1 + 1
else
endif
Range("A:D").EntireColumn.Autofit
Set Folder = Nothing
Set olFldr = Nothing
Set olApp = Nothing
End Sub
Display More
Please help and Thanks,
Marl