Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Disable VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Geoff332 - 26 Feb 2008 22:41 GMT
Hi,

I have a bunch of documents that use all sorts of macro code to format and
control the document. The documents are all based on a template and the code
is located in the template.

I want to add a "publish" function that will prepare the document for
sending out to customers (update a few fields, set document protection etc).
At the completion of the publish function, I want it to either disable or
remove the macros from the published instance document. This is important,
because we don't want to expose the macros and other bits and pieces to our
customers (or even to have the warning dialogue pop-up).

Is this possible?

The second piece that would be wonderful is to add the ability to reactivate
the code from the original template, to allow us to manage and update the
document. I can assume that the original template is available for this
function.
Jonathan West - 27 Feb 2008 00:49 GMT
> Hi,
>
[quoted text clipped - 13 lines]
>
> Is this possible?

If you create a document based on a template, the macros are not contained
in the document. The macros in thwe template remain available because the
document references the template. If you send a document out to a customer
without sending the template, the customer will not have the macros. You
don't need to take any special action to achieve this.

> The second piece that would be wonderful is to add the ability to
> reactivate
> the code from the original template, to allow us to manage and update the
> document. I can assume that the original template is available for this
> function.

provided that you re-open the document on a PC that has the template, then
the macros will be automatically available again. Provided the template is
in the same location as fore, or is in one of Word's recognised locations
(e.g. in the user templates folder) then again, no special action is
required.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Geoff332 - 28 Feb 2008 04:35 GMT
Thanks to both of you. I thought Word embedded the template macros in each
instance of the document (the way it does with styles). Obviously, this isn't
an issue.

> > Hi,
> >
[quoted text clipped - 31 lines]
> (e.g. in the user templates folder) then again, no special action is
> required.
Jonathan West - 28 Feb 2008 10:18 GMT
> Thanks to both of you. I thought Word embedded the template macros in each
> instance of the document (the way it does with styles). Obviously, this
> isn't
> an issue.

Its an easy mistake to make, especially as other Office apps behave
differently. For instance, Excel VBA macros *are* embedded in new workbooks
based on an Excel templates. These little inconsistencies in the way Office
works all make for an interesting time :-)

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Jay Freedman - 27 Feb 2008 00:53 GMT
>Hi,
>
[quoted text clipped - 15 lines]
>document. I can assume that the original template is available for this
>function.

You're under the mistaken impression that the macros from the template are
duplicated in the documents based on the template. They are not. The macros are
available when the document is open *on your computer* because the document
maintains a link to the template (visible in the Tools > Templates & Add-ins
dialog).

When you send the document to another computer that doesn't have the template,
the macros will not be available there. Because the original template isn't
available, the document will be attached to the recipient's Normal.dot template
instead.

When the document is returned to you, use the Tools > Templates & Add-ins dialog
to reattach it to the original template. Then the macros will be available
again.

For more discussion, see
http://www.shaunakelly.com/word/templaterelations/index.html.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.