PDA

View Full Version : Application.EnableEvents for Outlook or temporarily disable ThisOutlookSession?



nmgmarques
09-28-2017, 01:12 PM
Hey all. I think I need something similar to Application.EnableEvents = false to stop other subs from running at the same time as another of my Outlook macros. Seems that EnableEvents doesn't exist / work in outlook. How can I momentarily prevent other macros or subs from running till some lines of code have executed? Basically I want to send a mail with objMail.Send but i have an existing sub in ThisOutlookSession that sees when a mail is sent and auto opens a folder picker so I can select the folder where I want to store the sent mail. I want to prevent this sub from running, send the mail, then go back to activating the subs or something similar.
Right now, this doesn't work:


'Send mail but disable other events or subs first
Application.EnableEvents = False

objMail.Send

Application.EnableEvents = True