Delete Shapes from Word Macro Enabled Template using VBA
I have a Macro-Enabled Word Template that I have some shapes inserted. When I go to save the document I would like to delete some of the shapes but not all of the shapes.
The following code deletes all of the shapes. Is there a way to name the shapes individually so that they can be deleted in groups?
Dim strToPath As String
Dim strMsg As String
Dim iResponse As Integer
Dim i As Integer
strToPath = Me.FormFields("strToPath").Result
strMsg = strMsg & "If these steps are complete then select 'OK' to" & Chr(10)
strMsg = strMsg & "permanently save the form to your file" & Chr(10)
strMsg = strMsg & "or select 'Cancel' to return to the form." & Chr(10)
iResponse = MsgBox(strMsg, vbOKCancel, "Final Instructions Prior to Saving Form")
If iResponse = vbCancel Then
'Delete ActiveX Command Button
For i = ActiveDocument.Shapes.Count To 1 Step -1