Hi Jeff,
if you´ve read the article then you know there are a lot of samples for
different OL versions etc. I can´t know what you´ve tried so I can´t
know what you´ve maybe done wrong...
All samples handle only one item, e.g. if it comes into your Inbox or if
you´ve selected it, so you´d have to adapt these samples for your needs.
1. You need to loop through all items instead of handling only incoming,
new items.
2. If an item is converted call it´s SaveAs method for saving to your
harddisk.
This is an general sample for a loop through all folders´ items, which
you can adapt, too. At present the LoopItems and HandleMailItem methods
only handle MailItems. You could copy & paste for different object
types.
' <Sample: Loop through the Outlook folders hierarchy for handling _
each folder item>
Public Sub HandleAllItems(oRoot As Outlook.NameSpace)
LoopFolders oRoot.Folders, True
End Sub
Private Sub LoopFolders(oFolders As Outlook.Folders, _
ByVal bRecursive As Boolean _
)
Dim oFld As Outlook.MAPIFolder
' Loop through all folders.
For Each oFld In oFolders
' Loop through folder items
LoopItems oFld.Items
If bRecursive Then
' Call this function again for going _
deeper into the object hierarchy.
LoopFolders oFld.Folders, bRecursive
End If
Next
End Sub
Private Sub LoopItems(oItems As Outlook.Items)
Dim obj As Object
For Each obj In oItems
Select Case True
Case TypeOf obj Is Outlook.MailItem
HandleMailItem obj
Case TypeOf obj Is Outlook.ContactItem
' Another method for handling ContactItems
' etc.
End Select
Next
End Sub
Private Sub HandleMailItem(oItem As Outlook.MailItem)
' Do s.th. with the object.
End Sub
' </Sample>
--
Viele Grüße
Michael Bauer
I tried unsuccessfully to run that code. I don't know if I did
something wrong, but it just would not respond when I ran it. I changed
my security settings to medium and still nothing. Any thoughts? Still
rather new to VBA...
There are two things that I am trying to accomplish:
1. Convert a rather large .pst file with thousands of emails.
2. Simplify the process of saving current emails. One button would
create the filename and save it to the appropriate folder or user
selected folder.
Thanks