Microsoft Word Variable without Macro

6

1

Is there a way in MS Word 2007 (& up) to have a document variable that I can define and have updated across the document when I update that variable's value. For example:

My crazy neighbor has <CRAZY_CAT_VAR> cats!!!

I want to be able to define <CRAZY_CAT_VAR> as 9 and be able to have the document print/show 9 instead of <CRAZY_CAT_VAR>. I believe I've seen solutions where I can define variables in one of the document macros and then reference them using fields, but I'd prefer to do this solely via a GUI if at all possible.

Joel B

Posted 2012-07-30T13:47:53.703

Reputation: 1 075

Answers

5

I'm fairly sure Document Variables can only be set through macro, therefore since that is not a "GUI" option that is counted out.

You could achieve the same using Document Properties.

  1. Click the Word Ribbion.
  2. Choose Prepare.
  3. Choose Properties.
  4. In the panel that appears click the Document Properties button and choose Advanced Properties.
  5. Go to the Custom tab.
  6. Enter in a name and value for the property and press Ok.

Now insert a DOCPROPERTY field with the name you chose and you can display this information wherever you want in your document. If the value changes you can update the fields and the values will change in the document too.

One thing to note is I think that these properties are visible when you right click on the document in Windows Explorer and look under Properties.

Adam

Posted 2012-07-30T13:47:53.703

Reputation: 6 454

Note that "Document Properties" and "Custom Properties" are different things as far as VBA is concerned. – user228546 – 2017-12-02T21:33:13.017

2Insert > Quick parts > Document Property is where I found the DOCPROPERTY info. Also see: http://office.microsoft.com/en-au/word-help/field-codes-docproperty-field-HA102014613.aspx – David d C e Freitas – 2013-07-22T23:40:55.030

0

I'm not aware of a built-in solution. The best approximation so far is:

  • Create a variable as suggested by Adam.
  • Insert the variable into the document.
  • Select the variable in the document and create a "quick part" from this fragment.
  • Now, each time you need a variable in the document, you can select it from the quick parts.

As a GUI alternative, you can try my "Generative Word Variables" add-on: http://gewova.com/

olpa

Posted 2012-07-30T13:47:53.703

Reputation: 184