I have a Word document that contains a command button named "update".
How can I delete this button using VBA?
This should do it :
For Each o In ActiveDocument.InlineShapes
If o.OLEFormat.Object.Name = "update" Then
o.Delete
End If
Next
I think when you said 'Button Name' you ment 'Button Caption'; please try below code -
For Each o In ActiveDocument.InlineShapes
If o.OLEFormat.Object.Caption = "update" Then
o.Delete
End If
Next
Regards, Nilesh
PS: the caption is case sensitive, so you may want to check the case for caption.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With