Article ID: 159261
Article Last Modified on 8/10/2007
Private Sub CommandButton1_Click ()
Selection.TypeText TextBox1.Text
'When you click this button on the form, the contents of the text
'box is 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 OFF97: How to Run Sample Code from Knowledge Base Articles
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: wordcon vb vba vbe
Keywords: kbhowto kbinfo kbmacroexample kbusage KB159261