Can you run a macro automatically?

S

SteveB

I have the need to check a shared mailbox for incoming mail and acting
upon it when it arrives. I have discovered that rules will not work on
a shared mailbox so I'm in the process of writing a VBA routine to do
what I need. Is there a way to have this routine run "in the
background" so someone doesn't have to monitor the mailbox and manually
run a macro?

Thanks!
 
S

Sue Mosher [MVP-Outlook]

To set rules for another user's mailbox, you need to start Outlook with a profile that logs onto that mailbox directly.

For a VBA solution, you'd use the Namespace.GetSharedDefaultFolder method to return the desired folders and then use its MAPIFolder.Items.ItemAdd event to handle new items. The machine running the VBA code would, of course, need to be running 24/7 and would need to be using an Outlook profile that has permission to open that folder.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

SteveB

Thanks Sue, by the way I love your book! (Sorry if that appears to be a
shameless suckup, sometimes ya gotta do what ya gotta do!)

I really don't know what I'm doing with this VBA stuff so please bear
with me here. Do I understand correctly that if Outlook is running with
this VBA code, any new mail being recieved in the shared folder will be
processed?

THANKS!
 

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