Is it possible to write a macro to copy the date I received the message, paste this date into the subject and save the message in a specific directory as .msg (no unicode)?
Is it possible to write a macro to copy the date I received the message, paste this date into the subject and save the message in a specific directory as .msg (no unicode)?
Try this untested code.
More info here http://msdn.microsoft.com/en-us/libr...ice.15%29.aspxSub SaveAsSubjectRecTimeMsg() Dim selectedEmail As MailItem Dim emailsub As String Set selectedEmail = ActiveExplorer.Selection.Item(1) emailsub = GetValidName(selectedEmail.subject & selectedEmail.ReceivedTime) With selectedEmail .SaveAs "C:\direcotry\folder\" & emailsub & ".msg", olSaveAsType.olMSG End With End Sub Function GetValidName(sSub As String) As String Dim sTemp As String sTemp = sSub sTemp = Replace(sTemp, "\", "") sTemp = Replace(sTemp, "/", "") sTemp = Replace(sTemp, ":", "") sTemp = Replace(sTemp, "*", "") sTemp = Replace(sTemp, """", "") sTemp = Replace(sTemp, "<", "") sTemp = Replace(sTemp, ">", "") sTemp = Replace(sTemp, "|", "") GetValidName = sTemp End Function
To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx
If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.
Thanks! It works well.