Article ID: 181791
Article Last Modified on 8/21/2007
Private Sub CommandButton1_Click ()
Selection.TypeText TextBox1.Text
' When you click this button on the form, the contents of the
' text box are inserted into the active document at the location
' of the insertion point.
End Sub
Private Sub CommandButton2_Click ()
End
' When you click this button after you click the first command
' button, the form is closed. If you click this button instead of
' the first command button, the form is canceled.
End Sub
Sub FillInForm()
UserForm1.Show
End Sub
Private Sub UserForm_Initialize()
TextBox1.Text = "<default text>"
End Sub
where <default text> is the text you want to appear in the text box when
the form appears.173707 How to run sample code from Knowledge Base articles
163435 Programming resources for Visual Basic for Applications
Keywords: kbdtacode kbhowto kbmacroexample KB181791