The following Outlook macro will save all the messages in Inbox to the
folder defined at sPath in Outlook MSG format.
I have used the naming format - SenderName_Subject_Date Time.msg and as
there is lots of scope for illegal characters in filenames using this
method, I have replaced illegal characters with -
Sub SaveMessages()
Dim olItems As Outlook.Items
Dim olItem As Outlook.MailItem
Dim fName As String
Dim fPath As String
fPath = "D:\My Documents\Test\Versions\Even\Temp\"
Set olItems = Application.Session.GetDefaultFolder(olFolderInbox).Items
For Each olItem In olItems
fName = olItem.SenderName & "_" & olItem.Subject & "_" &
olItem.ReceivedTime & ".msg"
fName = Replace(fName, Chr(34), "-")
fName = Replace(fName, Chr(42), "-")
fName = Replace(fName, Chr(47), "-")
fName = Replace(fName, Chr(58), "-")
fName = Replace(fName, Chr(60), "-")
fName = Replace(fName, Chr(62), "-")
fName = Replace(fName, Chr(63), "-")
fName = Replace(fName, Chr(124), "-")
olItem.SaveAs fPath & fName
Next olItem
Set olItem = Nothing
Set olItems = Nothing
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
I have folders for incoming email, outgoing and so on. I just drag and
drop
or copy and paste.
But, are these saaved in the outlook.pst file or as separate files not
contained in outlook.pst
I am looking for the possibility of saving just these files in a
separate folder in "my documents"