Search code examples
vbabuttonms-wordcommandsimple-form

Ms Word Vba Command Button Insert Text on Word Doc


on click of the Command Button on MS WORD VBA FORM, a specific Text has to be inserted on the same MS Word Document on the place where the blinking cursor/Selection cursor is placed.

can someone place help me.


Solution

  • Private Sub CommandButton1_Click()
    Me.Hide
    With ActiveDocument.ActiveWindow.Selection
    
        .TypeText Text:="Your text here"
    
    End With
    End Sub