Closing a PST file

  • Thread starter Thread starter Mark Rae
  • Start date Start date
M

Mark Rae

Hi,

I'm using the code I found here:
http://www.outlookcode.com/codedetail.aspx?id=962 to open a local PST file -
works great.

However, once I'm finished working with the PST file, I want to close it
again so that it no longer appears in Outlook.

I've tried modifying the code above as follows:

Dim mobjOL As Outlook.Application
Dim mobjNS As Outlook.NameSpace
Dim mobjFolder As Outlook.MAPIFolder

Sub TestSetNewStore2()
Dim newStore As Outlook.MAPIFolder
On Error Resume Next

Set newStore = SetNewStore2("C:\MyNewStore.pst", "My New Store Folders")

' unfinished - folder processing goes here...

mobjNS.RemoveStore newStore ' new line to try to close the newStore
folders
Set newStore = Nothing
End Sub

This doesn't cause any runtime errors, but doesn't actually close the PST
file.

I'm obviously missing something fairly fundamental...

Any assistance gratefully received.

Mark
 
Back
Top