Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-20-2011, 05:06 AM
ilkks ilkks is offline Macro to remove MacroButtons Windows Vista Macro to remove MacroButtons Office 2007
Novice
Macro to remove MacroButtons
 
Join Date: May 2011
Posts: 23
ilkks is on a distinguished road
Default 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.
Attached Files
File Type: doc testi.doc (30.5 KB, 14 views)
Reply With Quote
  #2  
Old 05-20-2011, 11:23 AM
Catalin.B Catalin.B is offline Macro to remove MacroButtons Windows Vista Macro to remove MacroButtons Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, România
Posts: 386
Catalin.B is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 05-20-2011, 06:00 PM
macropod's Avatar
macropod macropod is offline Macro to remove MacroButtons Windows 7 32bit Macro to remove MacroButtons Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #4  
Old 05-22-2011, 11:03 PM
ilkks ilkks is offline Macro to remove MacroButtons Windows Vista Macro to remove MacroButtons Office 2007
Novice
Macro to remove MacroButtons
 
Join Date: May 2011
Posts: 23
ilkks is on a distinguished road
Default

That works like a charm, Thank you very much Paul!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to remove MacroButtons how to remove two lines? mryevrah Word 2 05-05-2011 01:41 AM
Macro to remove MacroButtons Need help on Macro 03- Find text - if text is blank then remove line simpleonline1234 Word VBA 1 02-25-2011 02:28 AM
Macro to remove MacroButtons How do I Remove Break? freschij Word 1 11-05-2010 08:40 AM
Macro to remove MacroButtons 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft