Change VBA Reference from PST to OST File

K

Karl Burrows

Someone wrote simple code that exports a calendar to a file for reference by
other users. We recently migrated to Exchange and I need to figure out how
to change the code to export the new OST file. Snippet of code is as
follows:

'Set reference to Specified Calendar folder
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set MyFolder1 = olns.Folders("Personal Folders")

'Set Calendar Folder Below
Set MyFolder2 = MyFolder1.Folders("CRITICAL DATES CALENDAR")
Set fld = MyFolder2

How do I change this to reference the new outlook.ost file used by Exchange?

Thanks!
 
K

Ken Slovak - [MVP - Outlook]

Since the OST file would be your default store you can just get the Inbox
folder (NameSpace.GetDefaultFolder(olFolderInbox). It's Parent property
object would be the Mailbox folder you see at the top of the folder list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top