问题
I have a Word document that contains a command button named "update".
How can I delete this button using VBA?
回答1:
This should do it :
For Each o In ActiveDocument.InlineShapes
If o.OLEFormat.Object.Name = "update" Then
o.Delete
End If
Next
回答2:
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.
来源:https://stackoverflow.com/questions/755247/how-do-i-delete-a-command-button-using-word-vba