Update field codes when opening Outlook Template

Status
Not open for further replies.

Mimi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi All,

A complete VBA newbie here.

I’m want to auto update field codes in an Outlook Template when it opens. The template is just a new message saved as an Outlook template with some of the text containing a field code.

I’ve tried writing a macro with Auto_Open(), AutoOpen(), and Workbook_Open functions, but no luck. I have my settings on outlook to allow any macro.


I added a new module that says:

Sub Auto_Open()
ActiveDocument.Fields.Update
End Sub

(It was working, although not right now).

I also tried putting the code in “this outlook session”.
The macro runs properly when I click on it, but does not auto run.

I'm also not sure the macro is actually attached to the template. When I send the template to others, the macro doesn't seem to be attached.

Thanks!
 

Mimi

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Perhaps it would be smarter to make a button that runs a macro that opens the template and updates the fields. ... Not totally sure how to do that yet...
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
outlook doesn't use autoopen. it can run word macros but I'm not sure if it can run word's auto open macros... I would use a macro that opens the template and updates - it beats browsing for the template. But if you want to open it your usual way, you need to use a new inspector macro - a sample is here Use a Default Subject for New Messages but you'll probably want to add an if statement so it only runs for a specific template.

How to Open Outlook Templates and Files using Toolbar Buttons
 
Status
Not open for further replies.
Top