Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Deleting text formatted with a certain paragraph style including the paragraph mark

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andreas - 25 Feb 2007 18:42 GMT
I would like to delete all text occurrences formatted with a specific
custom paragraph style including the paragraph mark. I am not sure how
to achieve this. Help is appreciated. Thank you very much in advance.

Regards,

Andreas
Greg Maxey - 25 Feb 2007 19:31 GMT
You don't need VBA to do this.  Just use Edit>Replace.  Find the style and
replace with nothing.

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> I would like to delete all text occurrences formatted with a specific
> custom paragraph style including the paragraph mark. I am not sure how
[quoted text clipped - 3 lines]
>
> Andreas
andreas - 26 Feb 2007 06:46 GMT
> You don't need VBA to do this.  Just use Edit>Replace.  Find the style and
> replace with nothing.
[quoted text clipped - 13 lines]
>
> - Zitierten Text anzeigen -

Greg,

thank you for your  information. With your help I wrote the following
macro (deleting this style will be a repetitive task).

Sub DelSubTOCStyle()

   With ActiveDocument.Content.Find
              .ClearFormatting
       .Replacement.ClearFormatting
       .Style = ActiveDocument.Styles("Dipl_SubTOC")
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
       .Execute Replace:=wdReplaceAll
         End With

End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.