Document Protection: How can we switch off highlighting by default

G

Guest

Word 2003: Is there a way using VBA to switch off the highlighting that
displays the editable regions of a document ? Shouldn't there be an option
to toggle this on/off in the Tools|Options|View menu (in the same way as for
normal highlighting)?
 
G

Graham Mayor

There is - Tools > options > view > field shading.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

Thanks Graham, but the field shading option works for 'normal'
grey-highlighted fields but not for the pale yellow highlight that comes on
with document protection :(
 
G

Graham Mayor

That shading option is toggled by the shading command on the forms toolbar

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

Yes, but I cannot find a way of being able to switch off this shading option
programmatically (via a macro in AutoOpen for example). It is not possible to
record the action in a macro and I can't see anything in VBA that'll do it.
 
J

Jay Freedman

Hi Steve,

This is the magic statement:

ActiveWindow.View.ShadeEditableRanges = False

or, if the document you want isn't active at the time, use the
appropriate Window object variable instead of ActiveWindow.

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

Guest

Perfect! I owe you a coffee. Thank you. Steve.

Jay Freedman said:
Hi Steve,

This is the magic statement:

ActiveWindow.View.ShadeEditableRanges = False

or, if the document you want isn't active at the time, use the
appropriate Window object variable instead of ActiveWindow.

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

Jay Freedman

Ahh, my drink of choice! Just pour it into your modem, I'll catch it
when it comes out. :)

Jay
 
J

Jay Freedman

Hi Jason,

You can't put a bare line of code like that into ThisDocument or anywhere
else. It has to be inside a procedure (a subroutine or function). Exactly
which procedure to use depends on when you want it to run.

Assuming you want this line of code to run whenever you open a document
based on a particular template, you have two choices
(http://www.word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm):

- In the ThisDocument area of the template, create a Document_Open()
procedure and put the line inside it.

- Insert a module in the template, create an AutoOpen() procedure, and put
the line inside it.

To run the same line when a new document is based on the template, also
create a Document_New() or AutoNew() procedure.

You may also get some helpful info at
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm.

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

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