Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Dialog Box - Getting user input.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
With a simple Custom Dialog Box, how do I get user input onto my word document? I have three user filled text fields that i need to transfer onto a table in Word 97. (I do not want to use the standard Input Box.)
 
Let's say you have userform1 with three text fields named txtField1, txtField2, and txtField3. Put a button on the userform, and link it to code like this:

Sub CommandButton1_Click()
ActiveDocument.Bookmarks("bkm1").Range.Text = Me.txtField1
ActiveDocument.Bookmarks("bkm2").Range.Text = Me.txtField2
ActiveDocument.Bookmarks("bkm3").Range.Text = Me.txtField3
Unload userform1
End Sub

Stan
You don't need bookmarks, of course. You can reference your document any way you like. But this shows how to reference the userform fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top