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 / General MS Word Questions / December 2003

Tip: Looking for answers? Try searching our database.

HELP!  Search, Block and Copy within a Macro??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MWallace - 31 Dec 2003 15:57 GMT
Is there any way to start a MACRO, SEARCH (for a word, phrase or symbol),
begin a BLOCK, SEARCH AGAIN (for another word, phrase or symbol) and end the
BLOCK?

For example, in the above question, is there a way, within a MACRO, to:

SEARCH for the word "start".
Turn-on the beginning of a BLOCK.
SEARCH for the word "begin".
Then, End the BLOCK.

I should end up with the following phrase "highlighted" (i.e. blocked):

        "start a MACRO, SEARCH (for a word, phrase or symbol), begin"

For some of my Reports I am still using WP5.1 because I can't figure-out how
to make WORD accomplish the above task!  In WordPerfect it's easy--- within
the MACRO, you simply start and end a block with <alt>F4.  Then, you can
move or copy the block anywhere you wish.

Your help in solving my problem is GREATLY appreciated!!!!

MWallace
Graham Mayor - 31 Dec 2003 17:50 GMT
You can use the wildcard replace functions to locate your required block of
text, which will thus be selected. See
http://www.mvps.org/word/FAQs/General/UsingWildcards.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP
      E-mail gmayor@mvps.org
     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Is there any way to start a MACRO, SEARCH (for a word, phrase or
> symbol), begin a BLOCK, SEARCH AGAIN (for another word, phrase or
[quoted text clipped - 22 lines]
>
> MWallace
Jay Freedman - 31 Dec 2003 18:13 GMT
In Word the equivalent to WordPerfect's Block command (Alt+F4) is
called Extend, and the shortcut is F8 (or double-click the letters EXT
on the status bar). The macro recorder will record the shortcut.

In a macro, you could do this:

   Selection.Collapse wdCollapseEnd
   With Selection.Find
       .ClearFormatting
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   
   With Selection
       .Find.Execute FindText:="start"
       .Extend
       .Find.Execute FindText:="begin"
   End With

An alternative would be to use the .Find properties of two Range
objects to find the start and end of the area you want, set the .End
of the first range equal to the .End of the second range, and then
.Select the resulting range.

>Is there any way to start a MACRO, SEARCH (for a word, phrase or symbol),
>begin a BLOCK, SEARCH AGAIN (for another word, phrase or symbol) and end the
[quoted text clipped - 19 lines]
>
>MWallace

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://www.mvps.org/word
 
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.