Document variable with value that changes throughout the document 
Author Message
 Document variable with value that changes throughout the document

I have a document in which I would like to use some sort of document
variable whose value changes throughout the document.  The variable is
to be set to a section title and this section title will vary
depending on the location within the document.  Its value will be set
by some sort of initialization statement.

The value of the variable will be referenced throughout the document
but this value varies depending on where the reference appears in the
document.

I tried to accomplish this by defining a bookmark and assigning it a
value.  If I have multiple SET fields to initialize the bookmark, the
REF fields always result in the most recent initialization of the
bookmark, even if the REF appears before the new initialization.

Is this possible?  If so, what is the best way to accomplish such a
task.



Mon, 11 Apr 2005 02:30:04 GMT  
 Document variable with value that changes throughout the document
Hi Chad,

When you have the Section Title, can you format that with a unique heading
style for the section? If so, you might be able to use the StyleRef field
(have a look at the topic "Field codes: StyleRef field" in Word's help
file). I'm assuming that the Section title and references to it are confined
to the same section; if they are not, then don't bother because it won't
work.

HTH


Quote:
> I have a document in which I would like to use some sort of document
> variable whose value changes throughout the document.  The variable is
> to be set to a section title and this section title will vary
> depending on the location within the document.  Its value will be set
> by some sort of initialization statement.

> The value of the variable will be referenced throughout the document
> but this value varies depending on where the reference appears in the
> document.

> I tried to accomplish this by defining a bookmark and assigning it a
> value.  If I have multiple SET fields to initialize the bookmark, the
> REF fields always result in the most recent initialization of the
> bookmark, even if the REF appears before the new initialization.

> Is this possible?  If so, what is the best way to accomplish such a
> task.



Mon, 11 Apr 2005 03:16:06 GMT  
 Document variable with value that changes throughout the document
While looking into this for you I tried to add a DocVariable to the
header called SectionName then to set that at various points in the
document.  I gave up when I saw a reference to Mail Merge in
the help file.  I think that you could use this in your document
by inserting fields into the document and then having the values
to those fields in a file.  Your mail merge will only have one
record with many fields.  If this did not give you all you needed
then you could (possible) add the rest with some VBA - maybe
to set up the mail mere file with the values taken from the
document.  They could be from the style used or a bookmark
used - maybe a heading style or a hidden text style.

It is just an idea that may help.

Chrissy.

Chad Clancy wrote

Quote:
> I have a document in which I would like to use some sort of document
> variable whose value changes throughout the document.  The variable is
> to be set to a section title and this section title will vary
> depending on the location within the document.  Its value will be set
> by some sort of initialization statement.

> The value of the variable will be referenced throughout the document
> but this value varies depending on where the reference appears in the
> document.

> I tried to accomplish this by defining a bookmark and assigning it a
> value.  If I have multiple SET fields to initialize the bookmark, the
> REF fields always result in the most recent initialization of the
> bookmark, even if the REF appears before the new initialization.

> Is this possible?  If so, what is the best way to accomplish such a
> task.



Mon, 11 Apr 2005 18:17:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How do I place a value of variable within a document

2. Create an AutoTextEntry with it's value set to a document variable

3. Retrieving a single Excel value into a Word document variable

4. Persistence of Document Variables values

5. Change font of document variable

6. Changing header values midway through a document

7. Insert a document into another document with a Form at startup

8. Document Window or Document Type

9. VBA code to print all icon-inserted documents within a document

10. Updating Documents Created From a Master Document Template

11. Disabling document blank space before close document

12. How to create a shortcut or alias to the document upon saving the document

 

 
Powered by phpBB® Forum Software