I use the following VBA code to incorporate the date at the beginning of each e-mail's subject in the Inbox. Is it possible to run the macro on the current folder (Inbox, Sent Items, Whatever), rather than naming a specific location?
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 = myNameSpace.GetDefaultFolder(olFolderInbox)
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
mItem.Save
End If
End If
Next j
Set mItem = Nothing
Set myFolder = Nothing
End Sub