Protect Document Styles Macro in Word 2003

L

Lisa

Hi,

I've been creating a template in Word 2003 and I don't want people to alter
the styles I have set so I've used the Protect Document setting to limit
formatting to a selection of styles. However, I've noticed that this also
disables various buttons in the toolbar, in particular bold, italic,
underline as well as table formatting.

I've worked out how to create a macro to enable/disable the various styles
using ActiveDocument.Styles("Body").Locked = False but I would like to know
if it's possible to do something similar to allow the bold, italic etc.
buttons to be enabled whilst the rest of styles are protected?

Any help would be greatly appreciated.

Lisa
 
G

Graham Mayor

I really don't know why you bother. Give them the template and train them to
use it.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Shauna Kelly

Hi Lisa

I think the best approach is to create character styles called Bold and
Italic and Underline and whatever (or, use the built-in Strong and Emphasis
styles). And in your template re-map the ordinary Bold and Italic buttons so
they apply your chosen style (to do that, use Tools > Customize etc, create
a button to apply each of your styles, copy the images from the existing
buttons to the new ones, and then delete the old buttons).

You'll need to re-map ctrl-b, ctrl-i, ctrl-u etc, too.

Make sure that your customizations are saved in the template, not in your
normal.dot.

This gives users a consistent interface, but you can retain the protection
for styles.

You might also think about what paragraph settings you want to make
available to users. For example, it bothers me that if I protect a document
for styles, a user can't set a paragraph with "keep with next" or "page
break before". That encourages the really awful habit of inserting manual
page breaks which seriously lowers user productivity as well as having
unfortunate side effects.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
L

Lisa

Hi Shauna

Thank you for your reply. I have considered creating character styles as you
suggest as a work around but I believe only one can be applied at a time and
I wanted to avoid creating lots of styles to cover the main ones which I
think people will use which is why I was looking at seeing if it's possible
to create a macro instead to tone down the protection. I've also noticed that
if some highlighted text is copied into the protected template you then
cannot turn the highlight off.

I have considered not having the protection on at all to solve the issue,
but the intended users will be copying information from documents using older
templates and although I intend to provide training it's a fair bet that some
people will just copy and paste and so new documents created from the
template will get contaminated with unwanted styles.

I like the idea of creating a custom toolbar. Is it possible to get the
toolbar to behave like the formatting one so that you can apply bold plus
italic rather than having to have a Bold Italic style?

Cheers
Lisa
 
J

Jonathan West

Lisa said:
Hi Shauna

Thank you for your reply. I have considered creating character styles as
you
suggest as a work around but I believe only one can be applied at a time
and
I wanted to avoid creating lots of styles to cover the main ones which I
think people will use which is why I was looking at seeing if it's
possible
to create a macro instead to tone down the protection. I've also noticed
that
if some highlighted text is copied into the protected template you then
cannot turn the highlight off.

If these are important to you, then in my opinion your only practical option
is to turn the protection off, and train the users to use the styles. You
can make it easier for them to remember to use the right styles by making
them more accessible. Take a look at this article for help in that
direction.

Creating Custom Toolbars for Templates
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=262
 
P

Phillip Ridgway

Hey Lisa,
Did you ever creat a document that was protected and still allowed youto do what you needed? I am running into the same problem. We have a large number of documents with different formats that need to be cut and pasted into a new master doc. Once the info is pasted into the doc the user needs to be able to bold and also highlight some but not all of the text. If you have found a way to protect a doc and still allow limitted format editing I would appreciate it if you pass the info along. Unfortunatly I am not all that familuar with styles, xml or word programing so if you have a doc already made that I could edit It would also help.

Thanks
Phillip



Lis wrote:

Hi ShaunaThank you for your reply.
24-Sep-07

Hi Shaun

Thank you for your reply. I have considered creating character styles as you
suggest as a work around but I believe only one can be applied at a time and
I wanted to avoid creating lots of styles to cover the main ones which I
think people will use which is why I was looking at seeing if it's possible
to create a macro instead to tone down the protection. I've also noticed that
if some highlighted text is copied into the protected template you then
cannot turn the highlight off

I have considered not having the protection on at all to solve the issue,
but the intended users will be copying information from documents using older
templates and although I intend to provide training it's a fair bet that some
people will just copy and paste and so new documents created from the
template will get contaminated with unwanted styles

I like the idea of creating a custom toolbar. Is it possible to get the
toolbar to behave like the formatting one so that you can apply bold plus
italic rather than having to have a Bold Italic style

Cheer
Lis

:

Previous Posts In This Thread:

Protect Document Styles Macro in Word 2003
Hi

I've been creating a template in Word 2003 and I don't want people to alter
the styles I have set so I've used the Protect Document setting to limit
formatting to a selection of styles. However, I've noticed that this also
disables various buttons in the toolbar, in particular bold, italic,
underline as well as table formatting

I've worked out how to create a macro to enable/disable the various styles
using ActiveDocument.Styles("Body").Locked = False but I would like to know
if it's possible to do something similar to allow the bold, italic etc.
buttons to be enabled whilst the rest of styles are protected

Any help would be greatly appreciated

Lisa

I really don't know why you bother.
I really don't know why you bother. Give them the template and train them to
use it

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<
Graham Mayor - Word MV

My web site www.gmayor.co
Word MVP web site http://word.mvps.or
<>>< ><<> ><<> <>>< ><<> <>>< <>><<

Lisa wrote:

Hi LisaI think the best approach is to create character styles called Bold and
Hi Lis

I think the best approach is to create character styles called Bold and
Italic and Underline and whatever (or, use the built-in Strong and Emphasis
styles). And in your template re-map the ordinary Bold and Italic buttons so
they apply your chosen style (to do that, use Tools > Customize etc, create
a button to apply each of your styles, copy the images from the existing
buttons to the new ones, and then delete the old buttons)

You'll need to re-map ctrl-b, ctrl-i, ctrl-u etc, too

Make sure that your customizations are saved in the template, not in your
normal.dot

This gives users a consistent interface, but you can retain the protection
for styles

You might also think about what paragraph settings you want to make
available to users. For example, it bothers me that if I protect a document
for styles, a user can't set a paragraph with "keep with next" or "page
break before". That encourages the really awful habit of inserting manual
page breaks which seriously lowers user productivity as well as having
unfortunate side effects.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word



Hi ShaunaThank you for your reply.
Hi Shauna

Thank you for your reply. I have considered creating character styles as you
suggest as a work around but I believe only one can be applied at a time and
I wanted to avoid creating lots of styles to cover the main ones which I
think people will use which is why I was looking at seeing if it's possible
to create a macro instead to tone down the protection. I've also noticed that
if some highlighted text is copied into the protected template you then
cannot turn the highlight off.

I have considered not having the protection on at all to solve the issue,
but the intended users will be copying information from documents using older
templates and although I intend to provide training it's a fair bet that some
people will just copy and paste and so new documents created from the
template will get contaminated with unwanted styles.

I like the idea of creating a custom toolbar. Is it possible to get the
toolbar to behave like the formatting one so that you can apply bold plus
italic rather than having to have a Bold Italic style?

Cheers
Lisa

:

Re: Protect Document Styles Macro in Word 2003

If these are important to you, then in my opinion your only practical option
is to turn the protection off, and train the users to use the styles. You
can make it easier for them to remember to use the right styles by making
them more accessible. Take a look at this article for help in that
direction.

Creating Custom Toolbars for Templates
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=262


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Submitted via EggHeadCafe - Software Developer Portal of Choice
More Fun with Fluent NHibernate Automapping
http://www.eggheadcafe.com/tutorial...9-81ee42171b00/more-fun-with-fluent-nhib.aspx
 
G

Graham Mayor

Document protection and free editing do not go hand in hand. What is the
purpose of the protection in the document?

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Carlie Jennings

Hi Phillip and Lisa,

This probably comes far to late for both of you, but might help others in the same boat.

I did exactly what Shauna suggested - created character styles for bold and italic, added them to my toolbar, and copied the existing bold and italic buttons to my customised toolbar.

Then I recorded two macros: one to turn text highlighting on, the other to turn it off. It's super easy - just select some text in your template, then start recording your macro (Tools > Macro > Record New Macro), click on the text highlighting button, and stop recording. For the macro to turn highlighting off, highlight some text in your template, select the highlighted text, and record the macro while you click the text highlighting button again to remove the highlighting from the selected text. Then add the macros to your customised toolbar.

In Phillip's case, I would recommend a 'paste special' macro I found somewhere (sorry - I can't remember the source!), which automatically re-formats copied text into your template style. Just paste the following text into your Visual Basic Editor (under Tools > Macros):


Sub PasteSpec()

Selection.PasteSpecial Link:=False, DataType:=wdPasteText

End Sub


And save the macro to your customised toolbar.

Cheers,
Carlie
 

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