Template- when saved as a new document remove macros

J

johnnykunst

I have a document template and have incorporated several macros (saved in just the document). I'd like to be able to make it so that when the user saves the filled out template as their own document (it'll have a new name of course)the new document has all the macros removed.
 
G

Graham Mayor

If the template really is a template and not a document, when new documents
are created from the template those documents do not contain the macros.
They remain in the template. Resaving existing documents with new names is
bad practice and will lead to loss of wanted documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

johnnykunst

I am saving it as a Word macro enabled template- when the new document is opened, if I go into VBA, the macro's are still there, under the original template, but not under the document.
 
G

Graham Mayor

That's how templates work!

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

If you move the document to another computer on which the template is not
available, the reference to the original template will be changed to
reference to the Normal.dot (dotm) template and the macros will not longer
be present or available.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
J

johnnykunst

I ended up using this macro to force the document to save as a rtf file and therefore with no macros- works perfectly (for anyone who might find it useful:

ActiveDocument.SaveAs FileName:=pStr, FileFormat:= _
wdFormatRTF, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
 
F

Fumei2 via OfficeKB.com

I think you are missing what has been said. The document does NOT have the
macros in it. The template does. True, saving as RTF means there are no
pointers back to the template macros. But a document cloned from a template
with macros, does NOT have the macros in the document. As was stated, if th
edocument is read on another computer with no access to the template iteslef,
NO macros are enabled.
 
F

Fumei2 via OfficeKB.com

I think you are missing what has been said. The document does NOT have the
macros in it. The template does. True, saving as RTF means there are no
pointers back to the template macros. But a document cloned from a template
with macros, does NOT have the macros in the document. As was stated, if th
edocument is read on another computer with no access to the template iteslef,
NO macros are enabled.
 
F

Fumei2 via OfficeKB.com

I think you are missing what has been said. The document does NOT have the
macros in it. The template does. True, saving as RTF means there are no
pointers back to the template macros. But a document cloned from a template
with macros, does NOT have the macros in the document. As was stated, if th
edocument is read on another computer with no access to the template iteslef,
NO macros are enabled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top