
Opening a *.pst file via code
This code can be used to create new folders in Outlook from Access
Dim appOutlook As New Outlook.Application
Dim nms As Outlook.NameSpace
Dim flds As Outlook.Folders
Dim fld As Outlook.MAPIFolder
Dim exp As Outlook.Explorer
Dim ins As Outlook.Inspector
Declare this variable as Object so it can be used for any type of item
Dim itm As Object
Declare these variables as specific item types
Dim msg As Outlook.MailItem
Dim con As Outlook.ContactItem
Set nms = appOutlook.GetNamespace("MAPI")
Set a reference to the top level folder "Personal Folders"
Set flds = nms.Folders("Personal Folders").Folders
Set a reference to a folder called "Custom Contacts" under the top-level
Personal Folders folder's Folders collection (via the previously set flds
variable)
Set fld = flds("Custom Contacts")
Add a new folder under the "Custom contacts" folder
Set myNewFolder = fld.Folders.Add("My Contacts")
Quote:
> Is there a way to programically open & close a *.pst file?
> I'm developing functionality that will allow Access to
> create & remove Outlook folders in various *.pst files. I
> need the ability to open a *.pst file if the *.pst file is
> not currently open.