Using variables in MS Word?

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I'm writing a document in MS Word which is to be customised for individuals. I realise that sounds like a job for mail merge but that's not really appropriate in this case. Each document will be customised individually as required and not in a batch.

I wondered if I could put a variable in the place of a name or phone number and then set that variable on the final page so all instances of the variable show that value.

For instance, the document might need to say:

"If you are concerned please contact your therapist, joe bloggs, on 01234 56789."

But I'm wondering if I could put:

"If you are concerned please contact your therapist, variable A, on variable B."

and then set the variables appropriately.

My instinct is to do it in excel which I know well but it's not ideal for text documents and these documents will be customised by people who can use Word but not too familiar with excel.

Any thoughts would be greatly appreciated.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Thanks - that get's me halfway there.

At the moment it doesn't really save any time or allow a novice user to do it. It's about as much work as putting the names in manually because of having to go through the menus.

I was hoping for a solution which allowed the user to fill in some properties at the end of the document e.g.:

physiotherapist - joe bloggs
occupational therapist - jane smith


and the custom properties would be picked up from there and repeated throughout the document (in excel you might set a property to 'B23' for instance)
 
Upvote 0
That would require VBA. Or mail merge.
 
Upvote 0
That would require VBA. Or mail merge.

I don't think its going to be practical to run a mail merge of just one document at a time?

I'll take a look at VBA although I've only used macros in excel so far so it'll probably be beyond my capabilities at the moment.

Is there such a thing as a pull down list in word like there is in excel?
 
Upvote 0
i'm trying to keep it simple for novice users but that may well be the easiest solution.
Thanks for all your advice.
 
Upvote 0
You don't require either VBA or a mailmerge for this, and Word does indeed have dropdowns you can use in a document - three different kinds, in fact, plus a combobox.

You could, for example, insert a dropdown content control into the document, formatted with a particular Style. Then, wherever you want the content selected from the dropdown replicated, insert a STYLEREF field referencing that Style. Having made the selection, simply select the entire document via Ctrl-A, then press F9 to update the STYLEREF fields.

Alternatively, or additionally, you could insert a dropdown content control into the document and apply a bookmark to its range. Then, wherever you want the content selected from the dropdown replicated, insert a REF field (e.g. via Insert|Cross Reference) referencing that bookmark. Having made the selection, simply select the entire document via Ctrl-A, then press F9 to update the cross references.

Yet another possibility is to use a dropdown formfield to hold the list, coupled with cross references to its internal bookmark name and 'filling in forms' editing restrictions. If you set the formfield's 'calculate on exit' property, the cross-references will update automatically any time you exit the dropdown.

So many possibilities... and not a hint of VBA or mailmerge.
 
  • Like
Reactions: shg
Upvote 0
You don't require either VBA or a mailmerge for this, and Word does indeed have dropdowns you can use in a document - three different kinds, in fact, plus a combobox.

You could, for example, insert a dropdown content control into the document, formatted with a particular Style. Then, wherever you want the content selected from the dropdown replicated, insert a STYLEREF field referencing that Style. Having made the selection, simply select the entire document via Ctrl-A, then press F9 to update the STYLEREF fields.

Alternatively, or additionally, you could insert a dropdown content control into the document and apply a bookmark to its range. Then, wherever you want the content selected from the dropdown replicated, insert a REF field (e.g. via Insert|Cross Reference) referencing that bookmark. Having made the selection, simply select the entire document via Ctrl-A, then press F9 to update the cross references.

Yet another possibility is to use a dropdown formfield to hold the list, coupled with cross references to its internal bookmark name and 'filling in forms' editing restrictions. If you set the formfield's 'calculate on exit' property, the cross-references will update automatically any time you exit the dropdown.

So many possibilities... and not a hint of VBA or mailmerge.

that's magic, paul. number 2 looks like the boyo for me.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,817
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top