Link to home
Start Free TrialLog in
Avatar of LindaWeston
LindaWeston

asked on

Outlook 2003 macro to automate deletion of mailbox items

am trying to find a quick, automated way to 'reset' the Outlook mailboxes on 10 training pc's.  I can reset most things by running Outlook with various switches, but so far have had no luck with clearing out all mailbox items (mail, calendar entries etc), or deleting any sub-folders previous delegates have created.  This is a tedious time-consuming job when you have to do it 10 times over before a training course!

I think possibly a macro is the way to go.  I am fairly confident using Excel VBA, but have never tried an Outlook macro, and there is no macro recorder in Outlook to get me started, so I am looking for help to write a macro to delete all Outlook items and extra folders.  Is this achievable?
Avatar of peakpeak
peakpeak
Flag of Sweden image

Another angle is to run Exchange Server on a virtual server. Then you can just restart the server without savit the state.
Found this which might point you in the right direction (scroll down for answer)
http://www.devnewsgroups.net/group/microsoft.public.office.developer.outlook.vba/topic63218.aspx
Avatar of LindaWeston
LindaWeston

ASKER

Thanks peakpeak, but have investigated this and have been told that it would be too expensive to implement.
Which solutuin? Virtual Server is free
Sorry, must have been adding my comment while your next one was flying through the ether!

I was told that we would have to buy another licence for Virtual Server.

Anway, having just double-checked this information with another member of our server team, they have just informed me that they have also been working on a solutioin and have been experimenting with Mailbox Manager, which has functionality to target specified mailboxes and manage them as we need to be able to.  They are now close to completing their tests and all being well we will be able to automate the resetting of the training mailboxes.

As this is the case, I guess I will just close this question?
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

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
Hi BlueDevilFan
Sorry for the delay in replying - I had some time off.
Thanks very much for this code, it looks like just what I wanted.  I will try it out when the training room is free later today, and then report back!

Linda
Hi BlueDevilFan
As our server team has now resolved the problem by using the Mailbox Manager utility, I will not need to put your solution into practice, but I am going to accept this as the solution to my question, as I am sure it would work as I wanted.  It has also given me some insight into code for Outlook!

Many thanks

Linda
Any time, Linda.
Earlier I accepted the VB code solution, which looked to solve my problem.  However, I didn't test the code because, in the meantime, an alternative solution had been developed by another team within my organisation.  Unfortunately, I have today found that their 'in-house' solution actually doesn't do the job properly and I need to use the VB solution given.  However, I have tried running the code but it fails with a VBScript compilation error, which I don't have the knowledge to fix. The error reported is:
Line: 20
Char: 27
Error: Expected ')'
Code: 800A03EE

Can anyone please help me with this one?
Many thanks.