Hiding frames with rules

B

Bear

I use VBA to change the definition of a style to toggle the Font property,
Hidden.

This works pretty well, except when the style defines a rule (border line)
above and below the paragraph and includes a frame.

The text disappears just fine, but the rules remain visible.

Does anyone have a workaround or solution to this?

Bear
 
J

Jay Freedman

Bear said:
I use VBA to change the definition of a style to toggle the Font
property, Hidden.

This works pretty well, except when the style defines a rule (border
line) above and below the paragraph and includes a frame.

The text disappears just fine, but the rules remain visible.

Does anyone have a workaround or solution to this?

Bear

When you toggle the Hidden property, also toggle the color of the borders
between white and Auto (or black, or whatever they were originally):

Sub StyleOff()
With ActiveDocument.Styles("Style1")
.Font.Hidden = True
.Borders(wdBorderTop).Color = wdColorWhite
.Borders(wdBorderBottom).Color = wdColorWhite
End With
End Sub

Sub StyleOn()
With ActiveDocument.Styles("Style1")
.Font.Hidden = False
.Borders(wdBorderTop).Color = wdColorAutomatic
.Borders(wdBorderBottom).Color = wdColorAutomatic
End With
End Sub

If the frame pushes text out of the way, you may also want to toggle the
style's .Frame.TextWrap property.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
B

Bear

Jay:

Thanks! You provided good ideas to check out and develop. It seems like the
better (more versatile and rugged) you make a macro, the longer and longer it
gets, doesn't it?

This isn't really critical. It's a conditional text tool. The showing and
hiding is only for a quasi-wysiwyg view so the author can test out his work
as he goes. The final edition is published by actually removing the material
that was formerly just hidden. So I have to figure out how much effort I want
to put into polishing the "preview" aspect of the tool.
 

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