Macro to do defied lines

S

Steved

Hello from Steved

I have 1 paragraph it has over 8500 lines

I would like the macro below to use 800 of the 8500 lines.

Each line I want the macro to do is unique in that
it is numeric and the font size is arial 30
Ok using below please what would be needed to find font
arial 30 and do each 800 lines. "Each line Starts with
font arial 30".

Thankyou.

Sub dictionary3()

Dim oPrg As Paragraph
Dim sTmp As String
Dim lPos As Long

For Each oPrg In ActiveDocument.Range.Paragraphs
oPrg.Range.Select
Selection.Collapse
Selection.Bookmarks("\line").Select
sTmp = Selection.Bookmarks("\line").Range.Text
sTmp = Left(sTmp, Len(sTmp) - 1)
lPos = InStr(1, sTmp, " ")
lPos = InStr(lPos + 1, sTmp, " ")
sTmp = Right(sTmp, Len(sTmp) - lPos)
lPos = InStr(sTmp, "(")
sTmp = Left(sTmp, lPos - 2)
Selection.Bookmarks("\line").Range.Text = sTmp & Chr
(11)
Next
End Sub
 
H

Helmut Weber

Hi Steve,
the macro I gave you processes the first line
in a paragraph, and produces errors, if these
lines do not meet certain specifications.
To process lines in a paragraph is something
different. Also, your specifications are insufficient.
"Each line Starts with font arial 30"

That should be:

All lines starting with font arial 30 are to be processed.
Right?

If so, there is still a problem with the number 800.
If exactly 800 lines meet the specification,
then you don't need the number at all.
Confusion caused by overspecification!
If more then 800 lines meet the specification,
then what 800 out of 800 + ?

Just search for font.name = "Arial",
font.size = 30

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
S

Steved

Hello Helmut from Steve

Yes each line starts with arial 30

All lines starting with font arial 30 are to be processed.
Right? Yes

Ignore the number it serves no purpose, I just used 800
to explain how many instances there are, as you correctly
say it can be ignored.

Just search for font.name = "Arial",
font.size = 30 Correct.

Thankyou.
 

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

Similar Threads


Top