Change VBA Reference from PST to OST File

  • Thread starter Thread starter Karl Burrows
  • Start date Start date
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!
 
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.
 
Back
Top