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

Tip: Looking for answers? Try searching our database.

Find method rebound sometimes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antonio Pérez - 18 Aug 2005 08:46 GMT
Hello :

I have a document with paragraphs and tables, in some cases  I have nothing
( only a carriage return symbol ), but ( because many people worked in the
docs ) it has a style I want to change.

I have a macro to find all these cases but my 'do... loop macro'  rebound
eternally  when find those cases. I fix the problem making  :

        Selection.MoveRight(Unit:=wdCharacter, Count:=1)
        Selection.MoveDown(Unit:=wdLine, Count:=1)

but it is not the solution ( in addition it fails )

Some idea ???
Antonio Pérez

Helmut Weber - 18 Aug 2005 10:14 GMT
Hi Antonio,

hm...

I think you should rather post the code that causes the problem
than your attempts at solving them. ;-)

Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Antonio Pérez - 18 Aug 2005 12:18 GMT
Here you are :

'-----------------------------------------------------------------------------------------------------

Selection.HomeKey wdStory       ' go to top
Selection.Find.ClearFormatting

With Selection.Find
  .Style = 'somestyle'
  .Text = " "
  Do
    ok = .Execute(, , , , , , True, wdFindStop)
   Loop While ok = True

End With
'---------------------------------------------------------------------------------------------------------
I'm going to explain it again :
In certain situations my code work fine, however inside tables or when I
have only a 'enter' or carriage return  this macro find allways the same
solution.

thanks

> Hi Antonio,
>
[quoted text clipped - 7 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
Helmut Weber - 18 Aug 2005 13:12 GMT
Hi Antonio,

This should cure the problems in tables:
[snip]
Do
ok = .Execute(, , , , , , True, wdFindStop)
If Selection.Information(wdWithInTable) = True Then
  Selection.EndKey
End If

Loop While ok = True
[snip]

However, I couldn't reproduce other endless loops.

Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Antonio Pérez - 19 Aug 2005 11:56 GMT
Thanks Helmut, i'm going to test it
Greetings from Spain

> Hi Antonio,
>
[quoted text clipped - 15 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
 
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.