I have a macro that was kindly donated by a subscriber to this site.
Sub AddDateToSubject()
Dim mItem As MailItem
Dim oFolder As Object
Dim j As Long
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
For j = myFolder.Items.Count To 1 Step -1
Set mItem = myFolder.Items.Item(j)
mItem.Subject = Format(mItem.SentOn, "YYYYMMDDhhmm") & " " & mItem.Subject
mItem.Save
Next j
Set mItem = Nothing
Set myFolder = Nothing
End Sub
The macro opens each individual post within my Outlook Inbox and adds the date to the subject (ie. “20070124 Original Subject Matter”).
On occasion, I receive messages in my Inbox that are in “Post” or “Delivery Receipt” format, as opposed to “Mail” format, causing the macro to crash. Any assistance in correcting this problem would be greatly appreciated.
Sub AddDateToSubject()
Dim mItem As MailItem
Dim oFolder As Object
Dim j As Long
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
For j = myFolder.Items.Count To 1 Step -1
Set mItem = myFolder.Items.Item(j)
mItem.Subject = Format(mItem.SentOn, "YYYYMMDDhhmm") & " " & mItem.Subject
mItem.Save
Next j
Set mItem = Nothing
Set myFolder = Nothing
End Sub
The macro opens each individual post within my Outlook Inbox and adds the date to the subject (ie. “20070124 Original Subject Matter”).
On occasion, I receive messages in my Inbox that are in “Post” or “Delivery Receipt” format, as opposed to “Mail” format, causing the macro to crash. Any assistance in correcting this problem would be greatly appreciated.