Macro coding

D

Dale

I am in the process of making a macro to format some
documents I use daily. I have one last thing to complete
the document with one click. Hoping someone has the
answer.
I have a document that is output from a SmartCam file. It
is in a word doc. I need to seach for specific text then
do a highlight down to format to a variable amount of
text and lines so movedown Units=lines doesn't work
because the information detail and lines changes. I do a
search for the start of the text thats always the same I
then want to highlight(select) down to the end of that
section where the text is the same. At that point I want
to format the text. I can't get a double FIND to work
with out unselecting text. Example Below

Tool/Description- This information always same
T1/.0156/ O.D. Rough Turn Tool- VARIABLE TEXT AND LINES
T1/ KM-40MCLNR4 with a CNMG 431 KC730
T1/Turns back Z-.04 deep.
T2/.0156/ O.D. Finish Turn Tool
T2/ KM-40MCLNR4 with a CNMG 431 KC730
T2/Turns back Z-.04 deep T1/.0156/ O.D. Rough Turn Tool
Collet/Chucking Information- This information always same

I have tried several times doing double FIND and VISUAL
BASIC manipulating code but still nothing. Please HELP

Thank You
Dale

..
 
H

Helmut Weber

Hi Dale,
I am not quite sure what you mean. The following
searches for "#0", extends the selection to "#1",
formats the selection (highlights it in yellow),
and repeats the process til the end of the document.
With Selection
.WholeStory
.Collapse
.Find.Text = "#0"
While .Find.Execute
.Extend
.Find.Text = "#1"
.Find.Execute
.Range.HighlightColorIndex = wdYellow
.Collapse direction:=wdCollapseEnd
.EscapeKey
.Find.Text = "#0"
Wend
End With
Of course, there are other ways to do that.
You have to provide for search options like
clearformatting etc., and it is assumed
that there are always pairs of "#0" and "#1".
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0
 

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