Link to home
Start Free TrialLog in
Avatar of Lau_Foren
Lau_Foren

asked on

Removing a store in Outlook using VBA

I have a list of PST files in Excel (with their full path)

a VBA running within excel would  open each PST file (load it) into Outlook and then count the items in each folder and close it.
It would then write in a cell the information from the PST and proceed with the others, until exhaust the list.

The ideal situation, would be to close (remove) any PST file loaded just after have been written the data into the excel spreadsheet. Any hint on how to remove a store (a PST file loaded in Outlook -other than the main PST file) ?

The code for load is pretty straightforward (just Outlk.addstore filepath&name)
but Outlk.removeStore does not work as easy...
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lau_Foren
Lau_Foren

ASKER

Thanks Mr.,

I use the following (and is working)

Set remPST = olkNS.folders.GetLast
olkNS.RemoveStore remPST

Best,

Lautaro
and what is the problem?
None, just only saying thanks and letting you know that in my specific case (where I load a PST file coming from an unknown and inaccessible profile) this do the work.
You're welcome
A solution