S
SuperSlueth
How do I get a macro to run automatically every time an email is
opened
opened
Tried what. It's impossible to know what message you're responding to. Please quote earlier messages.
I guess it might help if you described exactly what you have in mind by "the email is fully opened" and why you need to wait until then.
What errror? What's the mail environment? Do you see any different behavior with different format messages?
That's why I suggested using either the Inspector.Activate event or the MailItem.Open event, where your Inspectors.NewInspector code would instantiate the Inspector or MailItem object variable that you declare WithEvents. I'd go with MailItem.Open myself.
You might be confusing the MailItem.Open method and the MailItem.Open event. If you declare a MailItem object WithEvents and then instantiate it so that object represents a specific message, then the Open even fires when that message opens on the screen, whether the user does it manually or code does it programmatically. At that point, you should have access to the MailItem object's Attachments collection, but the message will not be displayed yet.
You might find the Inspector.Activate event works better for your scenario. It fires when the Inspector becomes the active window, which means it has displayed.
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.