|
#1
|
|||
|
|||
Macro to remove MacroButtons
I have macro-fields in the document, like this: { MACROBUTTON MacroAddProduct Double-click to add new product }
I am looking for a macro that removes this field (and others as well). I have tried to record a macro that uses 'Find and Replace': find {MACROBUTTON...} and replace with 'nothing' but Word is unable to find these fields. Word can only find normal text. Example-word-document is attached. So basically I need a macro that removes the macro-field on page 2, that is highlighted as yellow. |
#2
|
|||
|
|||
Maybe it is easier to ensure you donīt have itīs <Print Object> property enabled:
Right clic on the button- Format Control- Properties-Print Object |
#3
|
||||
|
||||
Hi ilkks,
Try something based on: Code:
Sub Demo() Dim oFld As Field With ActiveDocument For Each oFld In .Fields If oFld.Type = wdFieldMacroButton Then If Trim(oFld.Code.Text) = "MACROBUTTON MacroAddProduct Add new product" Then oFld.Delete End If Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
That works like a charm, Thank you very much Paul!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to remove two lines? | mryevrah | Word | 2 | 05-05-2011 01:41 AM |
Need help on Macro 03- Find text - if text is blank then remove line | simpleonline1234 | Word VBA | 1 | 02-25-2011 02:28 AM |
How do I Remove Break? | freschij | Word | 1 | 11-05-2010 08:40 AM |
How do I remove the gap in my header? | losty. | Word | 2 | 10-05-2010 01:21 AM |
Macro to remove duplicates in Refrences list | HowardC | Word VBA | 0 | 05-20-2010 09:57 AM |