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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting data from a Data Input Form in a word document

Status
Not open for further replies.

julesl

Technical User
Jul 16, 2003
14
GB
Hi

I have next to no knowledge of VB and have volunteered to create a template containing several input forms.

I have designed the forms in VBA (which include check boxes and combo box) but I have no idea how I’m going to get the data from the forms into the Word document.

For the form containing combo boxes, there could be several entries so I have 2 command buttons, one which should allow the user to add the contents of the combo boxes to a table in Word and then be able to add another entry to the table from the form. The other button should add the contents of the combo box to the table and close the form and open a new one.

I know I’m completely out of my depth here so any help would be greatly appreciated.

Thanks.


 
You would set the Click event to send the values of the different controls on your form to the specific cells in your table.
Code:
ActiveDocument.Tables(1).Columns(2).Cells(1).Range.Text = UserForm1.Text1.Text
In the example above, I am setting the value to the first cell in the second column of the first table to the value in text box in my userform. I also could have used:
Code:
ActiveDocument.Tables(1).Rows(1).Cells(2).Range.Text = UserForm1.Text1.Text

Dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top