RemoveStore with moved/deleted pst

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