PDA

View Full Version : VBA Field Code Refresh Question



chaddug
11-08-2012, 12:19 PM
I'm trying to edit a macro for Outlook 2007.

Every month, on the first, I have an excel sheet that I update with the previous months sales information, and then email a PDF copy to each of my salesmen. I have an email template setup and a macro that opens the template as a new message. I have a field code in the body of the email template that shows the date of the report (its just coded to subtract one month from the current date). The problem is that the field doesn't automatically refresh with the changing months when I open the template, it always shows the date from when I first created the email, unless I right click on it and select update field.

This isn't a huge issue, but I have to send out about 30 individual emails, so the less time I have to spend changing things the better. I have very little knowledge of VBA and have tried to piece together a code that would work based on similar codes I found online, but nothing seems to be working.

This is the code that I use to open the email template. If you could please edit it so that it also forces the field code in the email body to update I would really appreciate it.

Sub HowAreYouDoing()
Set newItem = Application.CreateItemFromTemplate("C:\Documents and Settings\Admin\Application Data\Microsoft\Templates\How Are You Doing.oft")
newItem.Display
Set newItem = Nothing
End Sub

chaddug
11-08-2012, 12:33 PM
If its not possible, is there another way to accomplish the same thing?