wordXP save document without macro/template code 
Author Message
 wordXP save document without macro/template code

Hi -
I am using a template and overriding "save", using ActiveDocument.SaveAs
from a button click event, and I want to strip out all of the macro/VBA
code, saving just a plain old document. I have tried specifiying the Normal
template in the saveas params, and I have tried saving as RTF, as well as
copying activedocument.content and pasting it to a new document. Each of the
attempts resulted in a file with macro code intact.

Is there a way to save the document via VBA, and have the resulting file
macro/template free?

thanks,

jay



Sun, 02 Jan 2005 00:00:27 GMT  
 wordXP save document without macro/template code
Hi Helion,

Quote:
> I am using a template and overriding "save", using ActiveDocument.SaveAs
> from a button click event, and I want to strip out all of the macro/VBA
> code, saving just a plain old document. I have tried specifiying the Normal
> template in the saveas params, and I have tried saving as RTF, as well as
> copying activedocument.content and pasting it to a new document. Each of the
> attempts resulted in a file with macro code intact.

1) Is the macro code in the document, or in the template to which the document
is attached? A document with a link to a template with macros will always link
in the macros, but not save them in the actual file. So the distinction is
very important. If this is the case, here, then you need to attach the file to
a different template (.AttachedTemplate property)

2) I suggest you test techniques "manually", first, before trying to code
them. Simply copying and pasting a document into a new file will NOT remove
macros; you must leave off the last paragraph mark - it "carries" across the
macros (and other things!)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Sun, 02 Jan 2005 19:39:05 GMT  
 wordXP save document without macro/template code
Hi - thanks for the reply!

the macro code is in the .dot template - I have tried changing the
.AttachedTemplate property, however in the saved document I lose the values
that were populated into the document (it is DB driven, with label.captions
being updated to reflect the DB values). Also, the buttons from the template
remain in the saved document, whereas I am seeking an output file with no
code or buttons, just a document only.

As an aside, I am inserting a .jpg file into the document as well..

thanks,

jay



Quote:
> Hi Helion,

> > I am using a template and overriding "save", using ActiveDocument.SaveAs
> > from a button click event, and I want to strip out all of the macro/VBA
> > code, saving just a plain old document. I have tried specifiying the
Normal
> > template in the saveas params, and I have tried saving as RTF, as well
as
> > copying activedocument.content and pasting it to a new document. Each of
the
> > attempts resulted in a file with macro code intact.

> 1) Is the macro code in the document, or in the template to which the
document
> is attached? A document with a link to a template with macros will always
link
> in the macros, but not save them in the actual file. So the distinction is
> very important. If this is the case, here, then you need to attach the
file to
> a different template (.AttachedTemplate property)

> 2) I suggest you test techniques "manually", first, before trying to code
> them. Simply copying and pasting a document into a new file will NOT
remove
> macros; you must leave off the last paragraph mark - it "carries" across
the
> macros (and other things!)

> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister
> http://www.mvps.org/word
> http://go.compuserve.com/MSOfficeForum

> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)



Mon, 03 Jan 2005 05:25:52 GMT  
 wordXP save document without macro/template code
Hi Helion,

Quote:
> the macro code is in the .dot template - I have tried changing the
> ..AttachedTemplate property, however in the saved document I lose the values
> that were populated into the document (it is DB driven, with label.captions
> being updated to reflect the DB values).

HOW were they "populated into the document"? Where are they being stored? Are
you using ActiveX controls?

Quote:
> Also, the buttons from the template
> remain in the saved document, whereas I am seeking an output file with no
> code or buttons, just a document only.

WHAT buttons? Where are they?

You've got to be a lot more specific than that if you want any one to help
you.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Wed, 05 Jan 2005 18:05:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. creating a macro to close a document without saving

2. Save document without including macros

3. Macro code lost when saving template???

4. Copy a document but without the document template

5. Save Excel file without Macro code in VBA

6. Saving a document without the code

7. Saving without saving macros

8. new documents look at the customized template for macros

9. Prevent documents referencing macros from template?

10. Template Save without prompting

11. Running macro inside a template document

12. Document management template/ macro with VBA

 

 
Powered by phpBB® Forum Software