Select and Hide text

C

Compass Rose

I am using Word 2003

I have been asked by a teacher to create a document which will be handed out
to her students. The document contains notes for the students, but also notes
for only the teacher's use in various places in the document. I have applied
a style called TeachNotesStart to the start of each section of teacher's
notes. (That style also includes a double line border at the top of the
paragraph to make the start of the teacher's notes stand out better on the
page). There may be from 2 to 6 or 7 lines of notes for the teacher. I have
applied a style called TeachNotesEnd to the last paragraph of the teacher's
notes, which also contains a double border at the bottom of the paragraph.

The teacher wants to hand out the document to the students without the
teacher's notes being printed, so I'd like to create a macro that selects all
instances of the text with the TeachNotesStart style, all instances of the
text with the TeachNotesEnd style and all text between the two styles and
hides the selected text.

Can this be done, or is there a simpler way to accomplish what I'm aiming for?

TIA
David
 
M

macropod

Hi Compass Rose,

You can easily do this without a macro-
.. Format the font for the TeachNotesStart as 'hidden'.
.. For editing purposes, make sure the 'hidden text' option (under Tools|Options|View) is checked.
.. For printing purposes make sure the 'hidden text' option (under Tools|Options|Print) is:
. checked for the teacher's notes
. unhecked for the student handouts
 
C

Compass Rose

Thanks, macropod.

I know I can do what you describe, but the teacher is not Word savvy and she
would get lost doing that for the whole document. The notes may appear in up
to 20 different places in the document. The purpose of writing the macro is
to be able to put a button linked to the macro on the document. Click of the
button and voila....notes hidden!

David


macropod said:
Hi Compass Rose,

You can easily do this without a macro-
.. Format the font for the TeachNotesStart as 'hidden'.
.. For editing purposes, make sure the 'hidden text' option (under Tools|Options|View) is checked.
.. For printing purposes make sure the 'hidden text' option (under Tools|Options|Print) is:
. checked for the teacher's notes
. unhecked for the student handouts

--
Cheers
macropod
[MVP - Microsoft Word]


Compass Rose said:
I am using Word 2003

I have been asked by a teacher to create a document which will be handed out
to her students. The document contains notes for the students, but also notes
for only the teacher's use in various places in the document. I have applied
a style called TeachNotesStart to the start of each section of teacher's
notes. (That style also includes a double line border at the top of the
paragraph to make the start of the teacher's notes stand out better on the
page). There may be from 2 to 6 or 7 lines of notes for the teacher. I have
applied a style called TeachNotesEnd to the last paragraph of the teacher's
notes, which also contains a double border at the bottom of the paragraph.

The teacher wants to hand out the document to the students without the
teacher's notes being printed, so I'd like to create a macro that selects all
instances of the text with the TeachNotesStart style, all instances of the
text with the TeachNotesEnd style and all text between the two styles and
hides the selected text.

Can this be done, or is there a simpler way to accomplish what I'm aiming for?

TIA
David
 
G

Graham Mayor

It is easy enough to do that with one click, but it relies on the user
formatting the notes with a dedicated paragraph style (otherwise how would
the macro know what were note and what wasn't. It doesn't really matter what
the style is called as long as it is uniquely used for the notes. In the
following example the style is called 'Notes' You can then use the following
macroattached to a toolbar button to toggle the display and when the notes
are displayed using this macro, they will also print.


Sub HideNotes()
With ActiveDocument.Styles("Notes").Font
.Hidden = Not .Hidden
If .Hidden = True Then
ActiveWindow.View.ShowHiddenText = False
Options.PrintHiddenText = False
Else
ActiveWindow.View.ShowHiddenText = True
Options.PrintHiddenText = True
End If
End With
End Sub

http://www.gmayor.com/installing_macro.htm


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


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


Compass said:
Thanks, macropod.

I know I can do what you describe, but the teacher is not Word savvy
and she would get lost doing that for the whole document. The notes
may appear in up to 20 different places in the document. The purpose
of writing the macro is to be able to put a button linked to the
macro on the document. Click of the button and voila....notes hidden!

David


macropod said:
Hi Compass Rose,

You can easily do this without a macro-
.. Format the font for the TeachNotesStart as 'hidden'.
.. For editing purposes, make sure the 'hidden text' option (under
Tools|Options|View) is checked. .. For printing purposes make sure
the 'hidden text' option (under Tools|Options|Print) is: . checked
for the teacher's notes . unhecked for the student handouts

--
Cheers
macropod
[MVP - Microsoft Word]


Compass Rose said:
I am using Word 2003

I have been asked by a teacher to create a document which will be
handed out to her students. The document contains notes for the
students, but also notes for only the teacher's use in various
places in the document. I have applied a style called
TeachNotesStart to the start of each section of teacher's notes.
(That style also includes a double line border at the top of the
paragraph to make the start of the teacher's notes stand out better
on the page). There may be from 2 to 6 or 7 lines of notes for the
teacher. I have applied a style called TeachNotesEnd to the last
paragraph of the teacher's notes, which also contains a double
border at the bottom of the paragraph.

The teacher wants to hand out the document to the students without
the teacher's notes being printed, so I'd like to create a macro
that selects all instances of the text with the TeachNotesStart
style, all instances of the text with the TeachNotesEnd style and
all text between the two styles and hides the selected text.

Can this be done, or is there a simpler way to accomplish what I'm
aiming for?

TIA
David
 
J

Johann Spurzheim

See More, http://www.moreaddin.com - it makes it very simple to add a button for hiding/showing any part of a document. Lots of additional functionality. No need to mess around with VBA (the add-in has it all taken care of).
I am using Word 2003

I have been asked by a teacher to create a document which will be handed out
to her students. The document contains notes for the students, but also notes
for only the teacher's use in various places in the document. I have applied
a style called TeachNotesStart to the start of each section of teacher's
notes. (That style also includes a double line border at the top of the
paragraph to make the start of the teacher's notes stand out better on the
page). There may be from 2 to 6 or 7 lines of notes for the teacher. I have
applied a style called TeachNotesEnd to the last paragraph of the teacher's
notes, which also contains a double border at the bottom of the paragraph.

The teacher wants to hand out the document to the students without the
teacher's notes being printed, so I'd like to create a macro that selects all
instances of the text with the TeachNotesStart style, all instances of the
text with the TeachNotesEnd style and all text between the two styles and
hides the selected text.

Can this be done, or is there a simpler way to accomplish what I'm aiming for?

TIA
David
On Monday, January 19, 2009 4:04 AM macropod wrote:
Hi Compass Rose,

You can easily do this without a macro-
. Format the font for the TeachNotesStart as 'hidden'.
. For editing purposes, make sure the 'hidden text' option (under Tools|Options|View) is checked.
. For printing purposes make sure the 'hidden text' option (under Tools|Options|Print) is:
. checked for the teacher's notes
. unhecked for the student handouts

--
Cheers
macropod
[MVP - Microsoft Word]


"Compass Rose" <[email protected]> wrote in message news:[email protected]...
 

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