Closing a PST file

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
 

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