Macro to run on Open

J

Jim

I have a macro that will add an attachment to the current Outlook message,
but I can't figure out how to get the macro to run automatically when the
message is opened. The message is a template (.oft). I'm new to Outlook
macros, can anyone help?

Thanks,
Jim
 
S

Sue Mosher [MVP]

That requires an event handler, not a macro. Since you're new to VBA, I
would suggest that you stick to the macro approach and write one that starts
by loading the .oft file:

Sub MyMacro
Dim newItem as Outlook.MailItem
Set newItem = Application.CreateItem("C:\my template.oft")
newItem.Attachments.Add "C:\myfile.doc"
newItem.Display
End Sub

That will probably save you the step of locating the .oft file.
 

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