A family of Microsoft word processing software products for creating web, email, and print documents.
Many thanks. I will explore this.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Good day. Let me start with a disclaimer: I am not a programmer by training and so any help that members of this community can provide would be appreciated. I have created a user form in Word which will be used to generate terms and conditions for customer's orders. There are some situations where there are several customers under the same ticket and so I have added a button which would enable the user to add additional textboxes to input additional names. The code for adding new textboxes is below. Once those textboxes are created on the form, I want do the following things: (1) set focus to the box just added; (2) restrict the creation of new boxes if any of the existing textboxes are still empty; (3) for each textbox, add a sequential bookmark using the name of that textbox and finally (4) capture the information entered in each textbox, (5) place it in the corresponding bookmark and then insert each bookmark with the captured text in the document. I can't seem to come up with the code to do this. Any help will be appreciated. Thanks.
This is the code that i use to add the new textboxes:
Dim num As Long
Private Sub cmd_Add_Click()
Static i As Integer
Dim bm As Long
Dim strInput As String
Dim txtbox As Object
Set txtbox = UserForm2.Controls.Add("Forms.TextBox.1")
i = i + 1
num = i
With txtbox
.Name = "Licensee" & i
.Left = 10
.Height = 20
.Width = 150
.Top = 20 + (30 \* i)
End With
End Sub
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Many thanks. I will explore this.
I would suggest having one Textbox on the UserForm and a LIstbox and a Command Button. Then when you have added the customer details into the Textbox, you would click on the Command button which would have the code to add that customer to the Listbox. When all customers have been added to the listbox, another Command Button would be used to transfer the data to the document, probably best done by the use of Document Variables.
See the following pages of Greg Maxey's website :
http://gregmaxey.mvps.org/Create\_and\_employ\_a\_UserForm.htm