How to remove a command button using Word VBA?

I have a Word document containing a command button called "update".

How can I remove this button using VBA?

+3
source share
2 answers

This should do it:

For Each o In ActiveDocument.InlineShapes      

   If o.OLEFormat.Object.Name = "update" Then
        o.Delete
    End If

Next
+6
source

I think when you said “Button Name” you will add “Button Caption”; please use the code below -

For Each o In ActiveDocument.InlineShapes
   If o.OLEFormat.Object.Caption = "update" Then
        o.Delete
    End If
Next

Regards, Nilesh

PS: the title is case sensitive, so you can check it for the title.

+1
source

Source: https://habr.com/ru/post/1706512/


All Articles