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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Excel to open a Word file and insert a macro 1

Status
Not open for further replies.

JasonEnsor

Programmer
Sep 14, 2010
193
GB
Hi Guys,

I am looking for a way to automate the process of attaching a macro to a word document. Okay so here is the reason, I do the occasional system design for a University they work great for the Administration staff...however the academic staff tend to cause me issues. I have a word template that i have setup using VBA that adds custom macro's for document editing. Occasionally the academics manage to break the link between the template and the document, so i would normally just re-attach it using a simple line of code. The issue is that because the admin staff use multiple computers it can mean having to set up the macro for the same user on several machines.

Ideally i would like to create either a excel/word/bat or even exe file that they can run to attach the macro(to assign the template) to the machine they are on (in there normal template). Failing that i would happily have them run the procedure so it attaches the template to all documents in a given file.

I think that makes sense :-S

Any ideas would be appreciated guys.

Thanks J.
 
hi

Occasionally the academics manage to break the link between the template and the document, so i would normally just re-attach it using a simple line of code.
I never heard of a document linked to a template. A template is used to create a document is some sort of standard format. I guess i don't understand something.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Create "Fixme.doc"

Put your code in the AutoOpen procedure.

When Fixme is opened by user code runs - assuming security doesn't prevent it.

Generally it's bad form to put code in normal.dot.
 
I never heard of a document linked to a template
Skip, have a look at the Document.AttachedTemplate property.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the idea mintjulep, I agree it is bad to put code in the Normal.dot but it was the best option I could think of as a quick fix. I think I will do as suggested and create a "FixMe.doc" to re-attach the template. I have a few new ideas on trying to reduce the academics having to modify the document too much so hopefully I won't need to worry about this for much longer.

Thanks Again

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top