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...
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and what is the problem?
ASKER
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
ASKER
I use the following (and is working)
Set remPST = olkNS.folders.GetLast
olkNS.RemoveStore remPST
Best,
Lautaro