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 / February 2005

Tip: Looking for answers? Try searching our database.

Macro will not End at bottom off the Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steved - 26 Feb 2005 22:01 GMT
Hello from Steved

The Macro finds the next first line By Identifing the
font size 30 and Bold, which is what it does, however
when it reaches the bottom of the document it then
deletes everthing above until it reaches the top of the
document. I goto debug it and it is highlighting
With Selection.Find.Font

Where in the Macro Can I put in telling it when it
reaches the bottom it stops.

Thanks in advance

Sub RaceDictionary2()
Dim i As Long
For i = 1 To ActiveDocument.Paragraphs.Count
   With Selection.Find
       .Text = "<[A-Za-z]@>"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindStop
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = True
   End With
   Selection.Find.Execute
   Selection.MoveLeft Unit:=wdCharacter, Count:=1
   Selection.Extend
   Selection.HomeKey Unit:=wdLine
   Selection.Delete Unit:=wdCharacter, Count:=1
   With Selection.Find.Font
       .Size = 30
       .Bold = True
   End With
   With Selection.Find
       .Text = ""
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindStop
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   Selection.Find.Execute
End With
Next i
End Sub
Jezebel - 26 Feb 2005 23:34 GMT
We answered this one several times three weeks ago, Steved. Didn't you like
the answers you got then?

> Hello from Steved
>
[quoted text clipped - 49 lines]
> Next i
> End Sub
Steved - 27 Feb 2005 00:14 GMT
Hello from Steved

Firstly yes I did like thje answer I got three weeks ago
and applied the solution I was given. I rewrote the macro
to try and find the problem which was not completely
solved, hence since then i.ve been trying to learn more
about macros. If I knew a place I could goto and find out
how to do loops I would be fine. ie the example below, I
would like to goto a site that would explain what each
line does, then and only then I would be able to put
together macro loops. So with this in mind  the macro
would read the first line of each paragraph until the end
of the document. believe me it is so simple but I've not
been able to put my head around it.

Dim i As Long
For i = 1 To ActiveDocument.Paragraphs.Count
End With
Next i

I should finish by saying this is a little project off my
own, and this is why I've come to this site for help, as
I do not use macros normally in word.

Thankyou

>-----Original Message-----
>We answered this one several times three weeks ago, Steved. Didn't you like
[quoted text clipped - 55 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.