PC Review
Forums
Newsgroups
Microsoft Word
Microsoft Word New Users
Re: macro for stripping
Forums
Newsgroups
Microsoft Word
Microsoft Word New Users
Re: macro for stripping
![]() |
Re: macro for stripping |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
This macro will do it. I created it by recording.
Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "\([0-9]{1,2}\)" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Larry |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Many thanks, great tips. The text to be deleted takes this
form: (1), (50), (34), and so forth. JF >-----Original Message----- >This macro will do it. I created it by recording. > > Selection.Find.ClearFormatting > Selection.Find.Replacement.ClearFormatting > With Selection.Find > .Text = "\([0-9]{1,2}\)" > .Replacement.Text = "" > .Forward = True > .Wrap = wdFindContinue > .MatchWildcards = True > End With > Selection.Find.Execute Replace:=wdReplaceAll > > >Larry > > >. > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi, I am not clear on how one puts wildcards into the find dialog box, as in the illustration below. Also, how do I do all this just by recording? What do you do, for example, to set the 'true' criterion? Do I need to learn VBA to do this? >-----Original Message----- >Many thanks, great tips. The text to be deleted takes this >form: (1), (50), (34), and so forth. JF > > >>-----Original Message----- >>This macro will do it. I created it by recording. >> >> Selection.Find.ClearFormatting >> Selection.Find.Replacement.ClearFormatting >> With Selection.Find >> .Text = "\([0-9]{1,2}\)" >> .Replacement.Text = "" >> .Forward = True >> .Wrap = wdFindContinue >> .MatchWildcards = True >> End With >> Selection.Find.Execute Replace:=wdReplaceAll >> >> >>Larry >> >> >>. >> >. > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
In the Find&Replace dialog, click the More button. Put a check in the box
"Use wildcards". Then enter the rest of the find and replace stuff. If you're recording when you click the Replace All button, the resulting macro will contain the .MatchWildcards = True line. The backslashes, braces, and brackets in the .Text line have special meanings when wildcards are turned on -- see http://www.mvps.org/word/FAQs/Gener...ngWildcards.htm as Graham told you. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://www.mvps.org/word feagin wrote: > Hi, I am not clear on how one puts wildcards into the find > dialog box, as in the illustration below. Also, how do I > do all this just by recording? What do you do, for > example, to set the 'true' criterion? Do I need to learn > VBA to do this? > >> -----Original Message----- >> Many thanks, great tips. The text to be deleted takes this >> form: (1), (50), (34), and so forth. JF >> >> >>> -----Original Message----- >>> This macro will do it. I created it by recording. >>> >>> Selection.Find.ClearFormatting >>> Selection.Find.Replacement.ClearFormatting >>> With Selection.Find >>> .Text = "\([0-9]{1,2}\)" >>> .Replacement.Text = "" >>> .Forward = True >>> .Wrap = wdFindContinue >>> .MatchWildcards = True >>> End With >>> Selection.Find.Execute Replace:=wdReplaceAll >>> >>> >>> Larry >>> >>> >>> . >>> >> . |
|
|
|
#5 |
|
Guest
Posts: n/a
|
works fine, many thanks to all, JF
>-----Original Message----- >In the Find&Replace dialog, click the More button. Put a check in the box >"Use wildcards". Then enter the rest of the find and replace stuff. If >you're recording when you click the Replace All button, the resulting macro >will contain the .MatchWildcards = True line. The backslashes, braces, and >brackets in the .Text line have special meanings when wildcards are turned >on -- see http://www.mvps.org/word/FAQs/Gener...ngWildcards.htm as Graham >told you. > >-- >Regards, >Jay Freedman >Microsoft Word MVP FAQ: http://www.mvps.org/word > >feagin wrote: >> Hi, I am not clear on how one puts wildcards into the find >> dialog box, as in the illustration below. Also, how do I >> do all this just by recording? What do you do, for >> example, to set the 'true' criterion? Do I need to learn >> VBA to do this? >> >>> -----Original Message----- >>> Many thanks, great tips. The text to be deleted takes this >>> form: (1), (50), (34), and so forth. JF >>> >>> >>>> -----Original Message----- >>>> This macro will do it. I created it by recording. >>>> >>>> Selection.Find.ClearFormatting >>>> Selection.Find.Replacement.ClearFormatting >>>> With Selection.Find >>>> .Text = "\([0-9]{1,2}\)" >>>> .Replacement.Text = "" >>>> .Forward = True >>>> .Wrap = wdFindContinue >>>> .MatchWildcards = True >>>> End With >>>> Selection.Find.Execute Replace:=wdReplaceAll >>>> >>>> >>>> Larry >>>> >>>> >>>> . >>>> >>> . > > >. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

