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

  • Thread starter Thread starter MWallace
  • Start date Start date
M

MWallace

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