MWE
10-20-2006, 01:48 PM
I am running ol2000 under WinXP. Most of the time a profile will have multiple pst files attached to it. How do I programatically sequence through the pst files. There does not seem to be a folders collection.
Thanks
I figured out how to do this (did a search on GetNameSpace and the rest was pretty easy). The code to sequence through the pst files is:
Sub olFolderDisplay()
Dim olApp As Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMAPIFolder As Outlook.MAPIFolder
Set olApp = Outlook.Application
Set olNameSpace = olApp.GetNamespace("MAPI")
For Each olMAPIFolder In olNameSpace.Folders
MsgBox olMAPIFolder.Name
Next olMAPIFolder
CleanUp:
Set olApp = Nothing
Set olMAPIFolder = Nothing
Set olNameSpace = Nothing
End Sub
Thanks
I figured out how to do this (did a search on GetNameSpace and the rest was pretty easy). The code to sequence through the pst files is:
Sub olFolderDisplay()
Dim olApp As Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMAPIFolder As Outlook.MAPIFolder
Set olApp = Outlook.Application
Set olNameSpace = olApp.GetNamespace("MAPI")
For Each olMAPIFolder In olNameSpace.Folders
MsgBox olMAPIFolder.Name
Next olMAPIFolder
CleanUp:
Set olApp = Nothing
Set olMAPIFolder = Nothing
Set olNameSpace = Nothing
End Sub