#1
|
|||
|
|||
User input to a variable on the document
This has got to be easy, and I must just be searching for the wrong terms...
In Word 2003, I want to put a variable in the document, let's say <<userinput>>. When the user opens the document, I want a message box to pop up and ask for input, and whatever they type in I want to populate into the <<userinput>> variable on the document. |
#2
|
|||
|
|||
Variables aren't on documents. You have add a DocVariable field to the document e.g., {DocVariable SomeDocumentName} then call an auto procedure then the document is opened or a new document is created from the template:
Code:
Sub Document_New() ActiveDocument.Variables("SomeVariableName").Value = InputBox("Enter the variable value") ActiveDocument.Fields.Update End Sub Sub Document_Open() ActiveDocument.Variables("SomeVariableName").Value = InputBox("Enter the variable value") ActiveDocument.Fields.Update End Sub http://gregmaxey.com/word_tip_pages/..._userForm.html |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Replacing text with user input.?.?.? | brad1977 | Word | 3 | 11-20-2012 10:20 AM |
Restricting User Input on a TextBox (and setting focus) | joatmon | Excel Programming | 1 | 06-05-2012 03:01 PM |
Help with VBA macro - Variable input | sc30317 | Excel Programming | 0 | 08-31-2011 01:00 PM |
Look up an array based on user input | johnsmb | Excel | 2 | 01-07-2011 01:12 PM |
Lock words in a document, but allow for input within the document | tlinde | Word | 1 | 02-09-2010 09:07 PM |