0

I need a CommandButton named 'CommandButton2', which when clicked deletes itself and goes to the next page and pastes itself along with some other data. I need the button to have the same recurring function so that whenever it is clicked, it performs the same function. But, on clicking the button, it generates a new button on the next page as 'CommandButton3' which no longer gives the required output.

Can you please provide a solution for this.

Here is my code:

Private Sub CommandButton2_Click()

Dim doc As Word.Document
Dim shp As Word.InlineShape
Set doc = ActiveDocument

Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.TypeParagraph
Selection.TypeText Text:="14.X    "

Selection.TypeParagraph
Set shp = Selection.InlineShapes.AddOLEControl("Forms.CommandButton.1")

shp.OLEFormat.Object.Caption = "Add Procedure"
doc.Paragraphs.Last.Alignment = wdAlignParagraphCenter

End Sub

0 Answers0