Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Issue with Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steved - 24 Nov 2004 07:16 GMT
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
Helmut Weber - 24 Nov 2004 09:51 GMT
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?
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Steved - 24 Nov 2004 18:32 GMT
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

>-----Original Message-----
>Hi,
[quoted text clipped - 19 lines]
>
>.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.