PC Review Forums Newsgroups Microsoft Word Microsoft Word New Users Re: macro for stripping

Reply

Re: macro for stripping

 
Thread Tools Rate Thread
Old 08-07-2003, 07:16 PM   #1
Larry
Guest
 
Posts: n/a
Default Re: macro for stripping


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


  Reply With Quote
Old 08-07-2003, 08:01 PM   #2
feagin
Guest
 
Posts: n/a
Default Re: macro for stripping

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
>
>
>.
>

  Reply With Quote
Old 08-07-2003, 09:09 PM   #3
feagin
Guest
 
Posts: n/a
Default Re: macro for stripping


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
>>
>>
>>.
>>

>.
>

  Reply With Quote
Old 08-07-2003, 10:19 PM   #4
Jay Freedman
Guest
 
Posts: n/a
Default Re: macro for stripping

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
>>>
>>>
>>> .
>>>

>> .



  Reply With Quote
Old 09-07-2003, 02:54 AM   #5
feagin
Guest
 
Posts: n/a
Default Re: macro for stripping

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
>>>>
>>>>
>>>> .
>>>>
>>> .

>
>
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off