![]() |
|
|
|
#1
|
||||
|
||||
|
You can add/query document Variables quite easily with VBA. For example:
Code:
Sub Demo()
With ActiveDocument.Variables
If .Item("MyVar") Is Nothing Then .Add Name:="MyVar", Value:="MyVal"
MsgBox .Item("MyVar").Value
End With
End Sub
Word's custom document properties are about as easy to work with, but built-in document properties require less work, since you always know they'll be there. Both kinds can also be viewed via File>Info>Properties and can be referenced in the document via a DOCPROPERTY field.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
split word document based on bookmarks with each new document title of the bookmark
|
megatronixs | Word VBA | 9 | 09-05-2020 02:29 PM |
| How to save active document to SharePoint document library | Rose roon | Word VBA | 9 | 09-22-2015 10:53 PM |
| document styles and some formatting doesn't appear where should when different people view document | Dilbert fan | Word | 1 | 08-23-2015 05:07 AM |
Run-time error '1004': Document not saved. The document may be open...
|
doctor_who12 | Excel Programming | 1 | 01-22-2014 04:47 PM |
How do I see one document map for each half of a split MS WORD 2010 document?
|
quickwin | Word | 3 | 07-09-2013 10:20 PM |