Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2013, 01:05 PM
dsm1995gst dsm1995gst is offline User input to a variable on the document Windows XP User input to a variable on the document Office 2003
Novice
User input to a variable on the document
 
Join Date: Sep 2013
Posts: 1
dsm1995gst is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 09-03-2013, 03:43 PM
gmaxey gmaxey is offline User input to a variable on the document Windows 7 32bit User input to a variable on the document Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

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
You could also use a bookmark, content controls, formfields or a userform:
http://gregmaxey.com/word_tip_pages/..._userForm.html
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
User input to a variable on the document Replacing text with user input.?.?.? brad1977 Word 3 11-20-2012 10:20 AM
User input to a variable on the document 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft