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

RE: Find method rebound sometimes by HelmutWeber

HelmutWeber
Thu Aug 18 04:14:02 CDT 2005

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





Re: Find method rebound sometimes by Antonio

Antonio
Thu Aug 18 06:18:49 CDT 2005

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



"Helmut Weber" <HelmutWeber@discussions.microsoft.com> escribió en el
mensaje news:BC404675-D322-4F31-8464-5397F6D3FEDF@microsoft.com...
> 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
>
>
>
>



Re: Find method rebound sometimes by HelmutWeber

HelmutWeber
Thu Aug 18 07:12:08 CDT 2005

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

Re: Find method rebound sometimes by Antonio

Antonio
Fri Aug 19 05:56:35 CDT 2005


Thanks Helmut, i'm going to test it
Greetings from Spain


"Helmut Weber" <HelmutWeber@discussions.microsoft.com> escribió en el
mensaje news:0087FEDC-A806-468B-87C4-DAF6BBD44E23@microsoft.com...
> 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