This is my code and I'm struck in filtering the date. I need to save the date and time info of User(harshahowrang@gmail.com)
email for last 30 days from now. have to be saved that info(time & date) in Excel sheet
Set ObjO = CreateObject("Outlook.Application")
Set olNs = ObjO.GetNamespace("MAPI")
Set objFolder = olNs.GetDefaultFolder(6)
For Each item1 In objFolder.Items
Dim sa, bc
bc = item1.ReceivedTime
sa = Format(item1.ReceivedTime, "dd-MM-yyyy")
spa = "27/02/2018"
If item1.UnRead And item1.SenderEmailAddress = "harshahowrang@gmail.com" And sa < spa Then
I can get the date and time using Item1 object but the challenging part for me is getting that info for last 30days from today.
It should not be more than 1 month.. so for every month i need to generate this macro to give the date and time of the emails of particular User and save that info in excel sheet.
Its a monthly activity which I was doing manually every month