Macro Lockup - Word 2000

D

Diane R

Hi all,

I am creating a macro that has to find occurences of a
string and hide the text. The macro works great - in
Word 2002. When I try to run it on a Word 2000 machine,
it invariably locks the program up (almost like it's
caught in a continuous loop). The code is pasted below.
Any help would be appreciated.

Thanks bunches, ya'll,
Diane
*****************
' Find ++SIG-- and hide
' Written by Diane 4/1/04
Selection.WholeStory
Selection.HomeKey Unit:=wdStory
'execute the find for ++SIG--
Selection.Find.ClearFormatting

With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Wrap = wdFindContinue
.Execute findtext:="++SIG--"
Do While .Found = True

If Selection.Font.Hidden = False Then
With Selection.Font
.Hidden = True
End With
End If

.Wrap = wdFindContinue
.Execute findtext:="++SIG--"
Loop
End With
 
D

Dave Lett

Hi Diane,

You're making this a little harder than it has to be by using the loop. Try
the following instead:

With Selection
.HomeKey Unit:=wdStory
With .Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Wrap = wdFindContinue
.Text = "++SIG--"
With .Replacement
.ClearFormatting
.Font.Hidden = True
End With
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave
 
D

Diane R

Testing now - so far so good :)

Thanks,
Diane
-----Original Message-----
Hi Diane,

You're making this a little harder than it has to be by using the loop. Try
the following instead:

With Selection
.HomeKey Unit:=wdStory
With .Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Wrap = wdFindContinue
.Text = "++SIG--"
With .Replacement
.ClearFormatting
.Font.Hidden = True
End With
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave




.
 

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