RemoveStore with moved/deleted pst

J

jual

Hello,

I have run into the scenario in which a pst which was opened using
AddStore was subsequently deleted or moved. When you start Outlook, it
complains that the file (the moved pst) cannot be found. If you right
click on the name of the folder in the folder list, and choose "Close
'name.pst'" Outlook will close it. When I try to do the same thing
with RemoveStore, I get an error:

Set oNameSpace = Application.GetNameSpace("MAPI")
Set oFolder = oNameSpace.Folders.Item("nameOfFolder")

'Prompt the user for confirmation
Dim strPrompt
strPrompt = "Are you sure you want to delete the folder?"

If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
oNameSpace.RemoveStore oFolder
End If

The error I get is from the oNameSpace.RemoveStore oFolder line and
says:

Error executing script

What is Outlook doing and can I mimic it?

Thanks

Allison
 
S

Sue Mosher [MVP-Outlook]

Outlook is throwing up its hands in dismay that there is a ghost .pst file in the store list. Such things won't close manually. (If you got a ghost .pst file to close manually, congratulations. You have a rare touch.) The only surefire solution is a new mail profile.
 

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