Does anyone know how to hide/unhide sections of a Word Document using VBA?

Re: Hiding Document Sections by Word

Word
Fri Dec 12 15:51:47 CST 2003

G'day "p horrigan" <phorrigan@chartermi.net>,

its a font property

"p horrigan" <phorrigan@chartermi.net> was spinning this yarn:

>Does anyone know how to hide/unhide sections of a Word Document using VBA?
>

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.

Re: Hiding Document Sections by JGM

JGM
Fri Dec 12 20:03:27 CST 2003

Hi p,

What Steve means is something like this:

This will toggle the current section beteween hidden and not hidden:

ActiveDocument.Bookmarks("\Section").Range.Font.Hidden = _
Not ActiveDocument.Bookmarks("\Section").Range.Font.Hidden

or, with the Selection object you achieve the same result:

Selection.Sections(1).Range.Font.Hidden = _
Not Selection.Sections(1).Range.Font.Hidden

If you want a particular section, without necessarily selecting it:

This will toggle section #2:
ActiveDocument.Section(2).Range.Font.Hidden = _
Not ActiveDocument.Section(2).Range.Font.Hidden

HTH
Cheers!
--
_______________________________________
Jean-Guy Marcil
jmarcil@sympatico.ca

"Word Heretic" <myname@wordheretic.com> a écrit dans le message de news:
a3ektvsfo5bjjn72t30nofc96pg264hjft@4ax.com...
> G'day "p horrigan" <phorrigan@chartermi.net>,
>
> its a font property
>
> "p horrigan" <phorrigan@chartermi.net> was spinning this yarn:
>
> >Does anyone know how to hide/unhide sections of a Word Document using
VBA?
> >
>
> Steve Hudson
>
> Word Heretic, Sydney, Australia
> Tricky stuff with Word or words for you.
> wordheretic.com
>
> If my answers r 2 terse, ask again or hassle an MVP,
> at least they get recognition for it then.
> Lengthy replies offlist require payment.



Re: Hiding Document Sections by Word

Word
Sat Dec 13 06:19:11 CST 2003

G'day "JGM" <no-spam@leaveme.alone>,

Thats the one :-)

"JGM" <no-spam@leaveme.alone> was spinning this yarn:

>Hi p,
>
>What Steve means is something like this:
>
>This will toggle the current section beteween hidden and not hidden:
>
>ActiveDocument.Bookmarks("\Section").Range.Font.Hidden = _
> Not ActiveDocument.Bookmarks("\Section").Range.Font.Hidden
>
>or, with the Selection object you achieve the same result:
>
>Selection.Sections(1).Range.Font.Hidden = _
> Not Selection.Sections(1).Range.Font.Hidden
>
>If you want a particular section, without necessarily selecting it:
>
>This will toggle section #2:
>ActiveDocument.Section(2).Range.Font.Hidden = _
> Not ActiveDocument.Section(2).Range.Font.Hidden
>
>HTH
>Cheers!

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.