Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Excel Template Question

Status
Not open for further replies.

thebernieb

Programmer
Jun 6, 2001
15
US
Folks,

I have created an application that uses VBA macros in Excel and Word templates to perform actions when a document is opened. This works splendidly and I have no problems. However, I do have a problem when I want to update the AutoOpen code. It is a tricky situation, so I'll explain.

Let's say that I have a document created in microsoft word based upon the normal template. In the normal template I have an autoopen macro that executes a series of commands. Any document I create from the normal template will execute these commands upon opening. If change the autoopen code in the normal template and open a document that was created using old normal template it will still use the new code.
This is nature of microsoft word. It will always link(refer) back to the template for the most current code.

Microsoft Excel on the other hand does not do this. If I create 10 documents based upon a given template then decide I want to change the code in the template, I have to update the code in each of the 10 documents. Why does Excel not link back to original template when opening a file? Is there any way to update the code in a group of .xls files by updated the template they were created from? Or do I have to create a "virus" and "infect" them with the new code I want?

Thanks for any help.

Bernie
 
When you create the original macro create it in a seperate file; then set the autoopen event to run that macro. This will give you one spot where you can make all of your changes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top