Issue with Macro

S

Steved

Hello from Steved

If I remove from the below macro

Dim i As Long, pararange As Range
For i = 1 To ActiveDocument.Paragraphs.Count
Set pararange to ActiveDocument.Paragraphs(i).Range
Next i

it works fine, please what do i need to do to make it
work.

Thankyou.

Sub RaceDictionary()
Dim i As Long, pararange As Range
For i = 1 To ActiveDocument.Paragraphs.Count
Set pararange to ActiveDocument.Paragraphs(i).Range
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$^$"
.Format = False
.MatchWildcards = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=2,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = "\(*by"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=2,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeBackspace
Selection.TypeText Text:="= "
Selection.EndKey Unit:=wdLine
Selection.TypeBackspace
Selection.TypeText Text:=", "
Selection.Find.ClearFormatting
With Selection.Find
.Text = "*$"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=2
Selection.TypeText Text:="X"
Selection.Extend
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
Selection.Find.Font.Size = 30
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Next i
End Sub
 
H

Helmut Weber

Hi,
hm...,
first
Set pararange = ActiveDocument.Paragraphs(i).Range
not
Set pararange to ActiveDocument.Paragraphs(i).Range
---
second
"pararange" seems never to be used in your macro.
So it would be absolutely useless.
third
Don not add or delete paragraphs
when looping using paragraphs count,
e.g. Selection.TypeParagraph
Besides that, what do want to do?
 
S

Steved

Hello Helmut from Steved

Magic Moon= by Siege Perilous, $1,000

Extract from below to get the above is my objective.

1. 2 Magic Moon (18) 4g b
Paris Opera (AUS)-Moon Princess (by Siege Perilous)
Mark Barnsley(56)
Stats:
Trnr: Les James (Trentham)
Ownr: G I, Dr J & Mrs M Bryce
All 1:0:1:0:0
Prz $1,000
F 1:0:1
E 0:0:0
S 0:0:0
H 0:0:0
C 0:0:0
D 0:0:0 F90 1:0:1:0
Fav 1:0:1:0
2 Fav 0:0:0:0
Win $0.00
Plc $1.25
Perf: YRAP 07 Nov 2004 - 2 of 8 Mdn cg&e $5K 1000 F2.2
Mark Barnsley 56 (7) 1/1 $2.95 1st: Tomo's Lad 57.44 .1L
Top effort when just beaten at only start after trialling
well. Not easy from draw.

Thanks
 

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