With the help and refinement of several posters on this forum, I created a macro in Outlook for inserting a date and time stamp on the front end of an e-mails subject, see below for code.
After updating to Outlook 2010 from 2003, the code which used to operate flawlessly now falls over on the "mItem.Save" line. I'm assuming the command has been modified or updated but would be grateful for any assistance in debugging?
]
After updating to Outlook 2010 from 2003, the code which used to operate flawlessly now falls over on the "mItem.Save" line. I'm assuming the command has been modified or updated but would be grateful for any assistance in debugging?
Code:
Sub AddDateToSubject()
Dim mItem As Object
Dim oFolder As Object
Dim j As Long
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = ActiveExplorer.CurrentFolder
For j = myFolder.Items.Count To 1 Step -1
Set mItem = myFolder.Items.Item(j)
If TypeName(mItem) = "MailItem" Then
If Left(mItem.Subject, 12) <> Format(mItem.SentOn, "YYYYMMDDhhmm") Then
mItem.Subject = Format(mItem.SentOn, "YYYYMMDDhhmm") & " " & mItem.Subject
[highlight #FCE94F]mItem.Save[/highlight]
End If
End If
Next j
Set mItem = Nothing
Set myFolder = Nothing
End Sub