Re: Text. Replacment.Text

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Charles Kenyon (msnewsgroup_at_remove.no.spam.addbalance.com)
Date: 04/14/04


Date: Tue, 13 Apr 2004 20:38:46 -0500

Hi,

You need to let us know what it is you want your macro to do. For future
reference, questions about macros probably should be posted in
word.vba.beginners.

Also, which version of Word are you using?

You may find <URL: http://word.mvps.org/FAQs/General/UsingWildcards.htm>
useful, as well.

-- 
Charles Kenyon
Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>
See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
 --------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"Steved" <anonymous@discussions.microsoft.com> wrote in message
news:1c2f601c421be$9f79a9b0$a401280a@phx.gbl...
> Hello from Steved
> Is it posible please to use VBA for the below as you can
> see i have put in 2 text, Replacement.Text in a macro. Can
> I have this run as a VBA if not can I have it so I can
> shorten this macro hence it
> .Text = "(CABALLERO PETE*)(^13)"
>         .Replacement.Text = "\1 Voodoo Rhythm \2"
> .Text = "(*HALBERG*)(^13)"
>         .Replacement.Text = "\1 Star Way \2"
> and so on I several of these to do. Thankyou.
>
>  Selection.Find.ClearFormatting
>     Selection.Find.Replacement.ClearFormatting
>     With Selection.Find
>         .Text = "(*CABALLERO PETE*)(^13)"
>         .Replacement.Text = "\1 Voodoo Rhythm \2"
>         .Wrap = wdFindContinue
>         .Format = False
>         .MatchCase = False
>         .MatchWholeWord = False
>         .MatchWildcards = True
>         .MatchSoundsLike = False
>         .MatchAllWordForms = False
>    End With
>     Selection.Find.Execute
>     With Selection
>         If .Find.Forward = True Then
>             .Collapse Direction:=wdCollapseStart
>         Else
>             .Collapse Direction:=wdCollapseEnd
>         End If
>         .Find.Execute Replace:=wdReplaceOne
>         If .Find.Forward = True Then
>             .Collapse Direction:=wdCollapseEnd
>         Else
>             .Collapse Direction:=wdCollapseStart
>         End If
>         .Find.Execute
>     End With
>     Selection.Find.ClearFormatting
>     Selection.Find.Replacement.ClearFormatting
>     With Selection.Find
>         .Text = "(*HALBERG*)(^13)"
>         .Replacement.Text = "\1 Star Way \2"
>         .Forward = True
>         .Wrap = wdFindContinue
>         .Format = False
>         .MatchCase = False
>         .MatchWholeWord = False
>         .MatchWildcards = True
>         .MatchSoundsLike = False
>         .MatchAllWordForms = False
>         End With
>     Selection.Find.Execute
>     With Selection
>         If .Find.Forward = True Then
>             .Collapse Direction:=wdCollapseStart
>         Else
>             .Collapse Direction:=wdCollapseEnd
>         End If
>         .Find.Execute Replace:=wdReplaceOne
>         If .Find.Forward = True Then
>             .Collapse Direction:=wdCollapseEnd
>         Else
>             .Collapse Direction:=wdCollapseStart
>         End If
>         .Find.Execute
>     End With
> End Sub
>


Relevant Pages

  • Re: Deleting the last table in a documnet
    ... I have an old macro written in wordbasic and I am trying ... to convert it to VBA for Word 97/2000. ... >You can collapse that into one line like this: ... the Selection has nothing to do with this ...
    (microsoft.public.word.vba.beginners)
  • Re: Spell or Dictionary function
    ... In a project, such as creating a puzzle, you would normally run code from a macro button. ... Almost anything is possible with VBA. ... For Each C In Selection ... Basic subroutiner. ...
    (microsoft.public.excel)
  • Re: Using current selection in a word macro
    ... VBA in Word always makes the Selection object available, ... Creating a macro with no programming experience using the recorder ... How to modify a recorded macro ...
    (microsoft.public.word.docmanagement)
  • Re: Spell Check Protected Form with Bookmarks
    ... You might also name your starter macro ToolsProofing. ... Microsoft's Legal Users' Guide) http://addbalance.com/usersguide ... This message is posted to a newsgroup. ... Bookmarks are not set to calculate on exit. ...
    (microsoft.public.word.spelling.grammar)
  • Re: Help finding autocorrect registry settings
    ... If you record the macro as mentioned in the article you can edit it in the ... This message is posted to a newsgroup. ... > The students log in with a unique login id. ... >>from my ignorance and your wisdom. ...
    (microsoft.public.word.customization.menustoolbars)