I am trying to have one button replace another. When button1 is clicked, some text is deleted. When button2 is clicked, the text is restored. I want to add the button replacement to the click event. It seemed simple. Both buttons are the same size and in the same position on the doc. So all the code has to do is move the top button to the bottom so the bottom button seems to replace it. Then when the button now on the top is clicked, it’s moved to the bottom. But the macro fails on the ToggleFormsDesign line. Without that line, the button cannot be selected:
Private Sub DeleteEnclLines_Click()
If ActiveDocument.ProtectionType = wdNoProtection Then
Else
ActiveDocument.Unprotect
End If
Do stuff
ActiveDocument.ToggleFormsDesign
ActiveDocument.Shapes(“Control 4”).Select
Selection.ShapeRange.ZOrder msoSendToBack
ActiveDocument.ToggleFormsDesign
ActiveDocument.Protect (wdAllowOnlyFormFields), NoReset:=True
End Sub
Maybe there’s a better way?