Protecting SET statements?

I

Ian

Using Word 97.

I want to build a template that contains several bookmarks, created with
SET statements. When using the template, the user will supply a custom
document property (e.g. "choice") specifying which bookmark to include
in the document. E.g.:

~~~~~~~~~~~~~~~~~~~~~~~~
SET {bookmark1 "first block of many pages of text"}

SET {bookmark2 "second block of many pages of text"}

{IF {DOCPROPERTY choice}=1 {bookmark1} {bookmark2}}

~~~~~~~~~~~~~~~~~~~~~~~~

If "choice" = 1, then the first multi-page block of text is inserted,
otherwise the second block. Once the chosen block is inserted, the user
is then free to edit it.

This works fine. However, I am very concerned that when users start
editing, they may accidentally delete the (invisible) SET statements,
thus generating "bookmark undefined" errors.

Is there any way I can protect the SET statements so that users can't
delete them?

Or is there a better way of defining alternative blocks of text for
editing?
 
C

Cindy M -WordMVP-

Hi Ian,

The only possible way you could protect this would be to insert a section
break immediately following the SET and then protect the document as a
form, leaving Section 2 unprotected. Depending on what you expect the user
to do with the document, this could work. But forms protection does disable
a number of commands, including headers/footers and using Drawing tools.

Another possible approach to consider would be to put the bookmarked text
(NOT using a SET field, just a regular bookmark) in a separate file. have
the IF field as part of an IncludeText field:
{ IncludeText "Pathinfohere" {If {DocProperty choice } = 1 "Bookmark1"
"Bookmark2" }

This would also solve the problem you mention in your other post, with the
quotation marks.
Using Word 97.

I want to build a template that contains several bookmarks, created with
SET statements. When using the template, the user will supply a custom
document property (e.g. "choice") specifying which bookmark to include
in the document. E.g.:

~~~~~~~~~~~~~~~~~~~~~~~~
SET {bookmark1 "first block of many pages of text"}

SET {bookmark2 "second block of many pages of text"}

{IF {DOCPROPERTY choice}=1 {bookmark1} {bookmark2}}

~~~~~~~~~~~~~~~~~~~~~~~~

If "choice" = 1, then the first multi-page block of text is inserted,
otherwise the second block. Once the chosen block is inserted, the user
is then free to edit it.

This works fine. However, I am very concerned that when users start
editing, they may accidentally delete the (invisible) SET statements,
thus generating "bookmark undefined" errors.

Is there any way I can protect the SET statements so that users can't
delete them?

Or is there a better way of defining alternative blocks of text for
editing?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

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

macropod

Hi Ian,

Instead of using SET statements, you could instead create more custom
DOCPROPERTY fields to hold the text strings that you want. For example,
DOCPROPERTY BkMrk1 might hold the string "I want to build a template that
contains several bookmarks, created with SET statements." and DOCPROPERTY
BkMrk2 might hold the string "When using the template, the user will supply
a custom document property (e.g. "choice") specifying which bookmark to
include in the document."
Then, your IF statement could become:
{IF {DOCPROPERTY choice}=1 {DOCPROPERTY BkMrk1} {DOCPROPERTY BkMrk2}}
This way, there's little risk of your text strings being deleted by
accident.

Cheers
PS: If you need to use curly quotes etc in the DOCPROPERTY text, you can
type them with the Alt-0145 and Alt-0146 key combinations for single quotes
and Alt-0147 and Alt-0148 key combinations for double quotes.
 
C

Cindy M -WordMVP-

Hi Macropod,
Instead of using SET statements, you could instead create more custom
DOCPROPERTY fields to hold the text strings that you want.
Except these can't contain formatting, fields and other things...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

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

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