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

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
 
J

Jay Freedman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top