Template- when saved as a new document remove macros

  • Follow


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. 
0
Reply johnnykunst (40) 4/24/2010 10:54:52 AM

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



"johnnykunst" <user@msgroups.net/> wrote in message 
news:ePrARy54KHA.5476@TK2MSFTNGP06.phx.gbl...
>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.
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.word.vba.general/ 


0
Reply Graham 4/24/2010 11:31:55 AM


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.
0
Reply johnnykunst (40) 4/24/2010 11:44:52 AM

That's how templates work!

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"johnnykunst" <user@msgroups.net/> wrote in message 
news:uydUNO64KHA.1424@TK2MSFTNGP04.phx.gbl...
>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.
>
> ---
> frmsrcurl: 
> http://msgroups.net/microsoft.public.word.vba.general/Template-when-saved-as-a-new-document-remove-macros 


0
Reply Graham 4/24/2010 11:52:25 AM

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

"johnnykunst" <user@msgroups.net/> wrote in message 
news:uydUNO64KHA.1424@TK2MSFTNGP04.phx.gbl...
> 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.
>
> ---
> frmsrcurl: 
> http://msgroups.net/microsoft.public.word.vba.general/Template-when-saved-as-a-new-document-remove-macros 

0
Reply Doug 4/24/2010 9:17:52 PM

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
0
Reply johnnykunst (40) 6/1/2010 11:50:17 AM

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.

johnnykunst wrote:
>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
>
>---
>frmsrcurl: http://msgroups.net/microsoft.public.word.vba.general/Template-when-saved-as-a-new-document-remove-macros

-- 
Gerry

Message posted via http://www.officekb.com

0
Reply Fumei2 6/2/2010 8:39:24 PM

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.

johnnykunst wrote:
>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
>
>---
>frmsrcurl: http://msgroups.net/microsoft.public.word.vba.general/Template-when-saved-as-a-new-document-remove-macros

-- 
Gerry

Message posted via http://www.officekb.com

0
Reply Fumei2 6/2/2010 8:39:34 PM

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.

johnnykunst wrote:
>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
>
>---
>frmsrcurl: http://msgroups.net/microsoft.public.word.vba.general/Template-when-saved-as-a-new-document-remove-macros

-- 
Gerry

Message posted via http://www.officekb.com

0
Reply Fumei2 6/2/2010 8:39:45 PM

8 Replies
914 Views

(page loaded in 0.146 seconds)

Similiar Articles:













8/1/2012 10:22:14 AM


Reply: