VBA macro printing attachments in shared mailbox

Status
Not open for further replies.

David Lynch

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I've just tried creating my first macro using examples from various other posts.

We have a shared mailbox and want to be able to trigger a macro (to print attachments) when a message is moved from the Inbox of the shared mailbox to another folder within the shared mailbox. I've created the macro on my PC and it works fine.

However, when testing I've noticed that if another user moves a message into this folder it also runs the macro that I have created. My assumption had been that I would need to add the same macro to each user's Outlook for this to work. If that's not the case what will happen if I do have the same macro on each user's machine? Will it run the same macro multiple times and therefore print multiple times? I don't want to have the macro running on a single machine as it will obviously cause problems when that machine isn't switched on.

I have a second issue also. If the attachments print successfully I want to move the email into a sub-folder (also on the shared mailbox) but can't get this to work. Any examples of moving messages between folders on a shared mailbox would be appreciated.

Thank you.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
IHowever, when testing I've noticed that if another user moves a message into this folder it also runs the macro that I have created. My assumption had been that I would need to add the same macro to each user's Outlook for this to work. If that's not the case what will happen if I do have the same macro on each user's machine? Will it run the same macro multiple times and therefore print multiple times? I don't want to have the macro running on a single machine as it will obviously cause problems when that machine isn't switched on.
The macro watches for new items in a folder - it only needs to run on one computer if you are watching a shared mailbox. If the macro is on more than one computer, it will likely run when each computer detects a change. (Test it to verify.) You can try setting flags - the macro on the computer where it's moved should fire first. You might be able to use the changed by field and run the macro only if the current user is the one who changed it... but it really depends on what is in the changed by field initially and if outlook changes it to the user's account. Replies and flags will change it - but just moving a message or marking as read isn't changing it here.


I have a second issue also. If the attachments print successfully I want to move the email into a sub-folder (also on the shared mailbox) but can't get this to work. Any examples of moving messages between folders on a shared mailbox would be appreciated.
What code are you using to identify the shared mailbox? After printing, you should be able to set a folder them move the mail object to it.
 
Status
Not open for further replies.
Top