Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Hiding frames with rules

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bear - 20 Apr 2007 14:46 GMT
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

Signature

Windows XP, Word 2000

Jay Freedman - 20 Apr 2007 15:16 GMT
> I use VBA to change the definition of a style to toggle the Font
> property, Hidden.
[quoted text clipped - 7 lines]
>
> 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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Bear - 20 Apr 2007 16:30 GMT
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.
Signature

Windows XP, Word 2000

> > I use VBA to change the definition of a style to toggle the Font
> > property, Hidden.
[quoted text clipped - 29 lines]
> If the frame pushes text out of the way, you may also want to toggle the
> style's .Frame.TextWrap property.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.