Pregunta

I am looking a way to check if in a Word document, the Text property of any text is set to Hidden or not.

I am using the following code but I think I am not doing in a right way.

Sub ToggleShowHiddenText()
    If ActiveWindow.View.ShowHiddenText = True Then
        MsgBox "Yes Text is hidden"
    End If
    If ActiveWindow.View.ShowHiddenText = False Then
        MsgBox "Text is not hidden"
    End If
End Sub
¿Fue útil?

Solución

I found a solution, thanks for @me how.

I go through word by word in the Active Document and then if Font.Properties are set to Hidden then show a Message Box.

Here is the code:

Sub ToggleShowHiddenText()


For Each sentence In ActiveDocument.StoryRanges

    For Each w In sentence.Words

       If w.Font.Hidden = True Then
        MsgBox w

        End If

    Next

Next

End Sub
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top