Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-23-2014, 12:29 PM
macropod's Avatar
macropod macropod is offline Macro to delete text in specific styles Windows 7 64bit Macro to delete text in specific styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Try:
Code:
Sub DeleteStyleText()
Application.ScreenUpdating = False
Dim strStyles As String, i As Long
strStyles = strStyles & "Style1,Style2,Style3,Style4,Style5,"
strStyles = strStyles & "Style6,Style7,Style8,Style9,Style10,"
strStyles = strStyles & "Style11,Style12,Style13,Style14,Style15"
With ActiveDocument.Content.Find
  .ClearFormatting
  .Format = True
  .Text = ""
  .Replacement.Text = ""
  .Wrap = wdFindContinue
  For i = 0 To UBound(Split(strStyles, ","))
    .Style = Split(strStyles, ",")(i)
    .Execute Replace:=wdReplaceAll
  Next i
End With
Application.ScreenUpdating = True
End Sub
where Style1 - Style15 are your actual Style names. You can use more Styles, or less; simply separate all the Style names with a comma.

PS: When posting code, please use the code tags - they're indicated by the # symbol on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete text in specific styles Delete specific text Jackson Word VBA 16 12-06-2019 08:24 PM
Macro to delete text in specific styles Macro to change specific text styles ljd108 Word VBA 3 10-22-2014 03:19 PM
Macro to delete text in specific styles Delete specific mass text on document JadeRisley Word 4 07-17-2013 11:11 PM
Macro to delete text in specific styles Using macro to delete styles fogharty Word 1 10-10-2011 03:42 PM
Macro to delete text in specific styles Need help extracting specific text from one doument to another with macro/VBA. zsmithku Word 1 04-15-2011 03:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 AM.


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