# Creating A Dynamic Email Template in Outlook 2003 (OFT)



## discomaniac (Jun 12, 2010)

Hi,

I am wanting to create a dynamic Outlook Template (OFT) please.

I require the template to dynamically pull some of the data from a excel spreadsheet at random, is this field will be ever changing and have multiple possibilities eg different jokes or riddles etc

Can someone please tell me how to create this type of template for Outlook please?

Thank you


----------



## RSpecianjr (Jan 20, 2010)

Hey discomaniac,

I worked with this before but the other way around. I had the excel file create the email. This could be an easier approach, though, you should be able to do it either way. It's been a looonng time since ive done integration of the two, so it might take me some time to get the macro working. Which way would you like it to go? Open outlook and send or open Excel and send?

Thanks,

Robert Specian Jr.


----------



## discomaniac (Jun 12, 2010)

Hi 

Thank you for your reply, my prefered method would be using outlook, thank you and I look forward to hearing from you


----------



## RSpecianjr (Jan 20, 2010)

Hey discomaniac,

I'm not going to lie, this is going to take me a while haha. I'm slammed at work right now. Ill list how I would approach it and hopefully someone can get to it before I can. Glaswegian and Macropod are both quite adept with microsoft products. Though, this will likely be VB and not VBA.

Here is how I would approach it:

The excel spreadsheet will have to have at least three columns. Column A is a numbering system, 1...2... all the way down. The rest of the columns will be your Jokes.. Riddles... what have you. *note: headings are required, bolden them as well.

Upon composing a creating new mail (of the custom form) it will set a variable to a randomly generated number. Run an SQL query to pull in a random Joke from Column B based on the random number (which can be looked up in column A). Link the value of appropriate field in the OFT to the SQL result.

Repeat for each field you need filled out.


Alternate:

Open the excel file.
Pull out random information needed.
Put information into proper fields.
Close Excel file.

Either way should work fine. Assuming the size of the excel file isn't very big, the second option is probably the better.

HTH,

Robert Specian Jr.


----------



## discomaniac (Jun 12, 2010)

Thank you I can hardly weight, sounds awesome, just wish I knew how to do it


----------

