Deleting CommandButtons by name in VBA Word 2010
问题 In a word template, I have two command buttons namely [Add section] which is named "CommandButton1" [Done] - which is named "CommandButton2" I need both buttons to be deleted at the click of [Done] Here's my code so far Private Sub CommandButton2_Click() Dim i As Integer For i = ThisDocument.InlineShapes.Count To 1 Step -1 With ThisDocument.InlineShapes(i) If .OLEFormat.Object.Name = "CommandButton1" Then .Delete End If End With Next End Sub The code is a combination of snippets I found