Fantpmas
09-20-2013, 01:45 AM
I want to hide all non-green text in a Word document to be able to process it easier in a translation environment. Only green text needs translation and setting the other text to hidden, makes that other text untranslatable in thetranslation environment.
The following macro has two problems:
Sub HideNonGreenText()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "*"
.MatchWildcards = True
.Wrap = wdFindAsk
While .Execute
If rDcm.Font.ColorIndex <> wdGreen Then
rDcm.Font.Hidden = True
End If
Wend
End With
End Sub
It's slow
I have to add .Wrap = wdFindAsk for it to go forward. Ideally it would just stop at the end of the document without prompting me.
Any tips would be very much appreciated.
Thomas
The following macro has two problems:
Sub HideNonGreenText()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "*"
.MatchWildcards = True
.Wrap = wdFindAsk
While .Execute
If rDcm.Font.ColorIndex <> wdGreen Then
rDcm.Font.Hidden = True
End If
Wend
End With
End Sub
It's slow
I have to add .Wrap = wdFindAsk for it to go forward. Ideally it would just stop at the end of the document without prompting me.
Any tips would be very much appreciated.
Thomas