How Does One Determine if a Style’s Font is Hidden?

S

StevenM

The following code hides the text using the styles “Even # Answer†and “Even
# Answer Headerâ€:

Sub FEN2Word_SE_Toggle()
ActiveDocument.Styles("Even # Answer").Font.Hidden = True
ActiveDocument.Styles("Even # Answer Header").Font.Hidden = True
End Sub

But what I would really like this macro to do is something like:

Sub FEN2Word_SE_Toggle()
If Text_Hidden then
'unhide text
ActiveDocument.Styles("Even # Answer").Font.Hidden = False
ActiveDocument.Styles("Even # Answer Header").Font.Hidden = False
Else
'hide text
ActiveDocument.Styles("Even # Answer").Font.Hidden = True
ActiveDocument.Styles("Even # Answer Header").Font.Hidden = True
End If
End Sub

I want this macro to hide and unhide text. How does one determine if a
style’s font is hidden?

Any help will be greatly appreciated.

Steven Craig Miller
New Lenox, IL (USA)
 
G

Graham Mayor

Almost there :)

Sub FEN2Word_SE_Toggle()
If ActiveDocument.Styles("Even # Answer").Font.Hidden = False Then
ActiveDocument.Styles("Even # Answer").Font.Hidden = True
Else
ActiveDocument.Styles("Even # Answer").Font.Hidden = False
End If
If ActiveDocument.Styles("Even # Answer Header").Font.Hidden = False Then
ActiveDocument.Styles("Even # Answer Header").Font.Hidden = True
Else
ActiveDocument.Styles("Even # Answer Header").Font.Hidden = False
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

StevenM

To: Graham Mayor,

Thank you very much. That worked perfectly! Thanks!

Steven Craig Miller
New Lenox, IL (USA)
 
G

Graham Mayor

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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