Styles, text fields and protection problem.

A

AnttiK

My problem is in styles and in protecting document. I want to create a fax
template with styles and protection. I am using text form fields. My
protection settings are as follows: “Formatting restrictions†checked,
“Editing restrictions†is filling in forms and enforcing is enabled.

I have three different styles to use in one text field. I have body text for
normal text and two different kinds of headings. FaxHeading1 is for bigger
headings and FaxHeadings2 is for smaller headings (such as paragraph headings
etc.). All of styles are enabled in formatting restrictions list.

After this I can’t anyhow change style in text form field. Field seems to
have that style which was used when I created the field and it can not be
changed afterwards.

Is there different kind of way to do this? It is very important that users
can not change headers, footers, address fields and layout.

Best regards from Finland.

Antti Koskalo
 
A

AnttiK

Seriously, what are you actually trying to do? WHY might your users change
the headers, footers, etc in ways you don't want?

Why they change layout? I don't know it even myself. They just do it. Maybe
because they think it's ok.

What I try to do:

I try to make protected document, which contains fields, where users can
type text. Text can be body text or two different type of heading texts.
Users are allowed to type only to specific areas (in this case text fiels)
and with those styles what I mentioned.

My question was, how can I make this kind of document ?

-Antti
 
A

AnttiK

"Jezebel" kirjoitti:
It's called a "form", well documented in help.

Where your question becomes challenging is the issue of *preventing* users
screwing up your document. If you can assume that your users have no
malicious intent, there's no problem -- create a form in the usual way and
simply *ask* them not to muck around with it. Not even worth posting a
question about... just follow the examples in Help.

If you can't make that assumption you need to be *very* specific about what
you're trying to achieve.'Allowed' in the sense that getting it wrong will
literally kill people? -- (which is the case with some kinds of
documentation.)

We are already using forms. Unfortunately we cannot make the assumption that
the layout of the document will stay untouched, therefore we must protect it
from such changes. We are trying to allow only the use of four or five
different styles inside the text form fields. For some reason after
protecting the document, no styles are selectable by the user. This is
strange since the "1. Formatting restrictions" section of the protect
document gives the idea of being able to choose from certain styles. Are we
misunderstanding something, or is there another way of handling the issue?

-Antti
 
S

Suzanne S. Barnhill

Formatting restrictions are for ordinary templates, not forms. You can apply
a specific style to a text form field, but all the entered text will be in
that style.
 
J

Jay Freedman

"Jezebel" kirjoitti:

We are already using forms. Unfortunately we cannot make the assumption that
the layout of the document will stay untouched, therefore we must protect it
from such changes. We are trying to allow only the use of four or five
different styles inside the text form fields. For some reason after
protecting the document, no styles are selectable by the user. This is
strange since the "1. Formatting restrictions" section of the protect
document gives the idea of being able to choose from certain styles. Are we
misunderstanding something, or is there another way of handling the issue?

-Antti

Hi Antti,

I assume you're working with Word 2003, since the formatting
restrictions first appeared in that version. The following method
works in all versions back to Word 2000 (maybe 97, I'm not sure)
because it doesn't depend on the restriction -- it's just that your
template will supply the only methods of changing the style in text
fields, and you supply only the styles you want.

When the form is protected, Word disables all methods of changing the
style, through dialogs, shortcuts, and VBA. The solution is to use VBA
to unprotect the document, change the style, and then restore the
protection, all in one operation.

You can place macros like these in your template (you may need to
change the names of the styles, as these aren't constant from one
language version to another). Also create toolbar buttons and/or
keyboard shortcuts to make it easy to call the macros.

Sub FieldStyleNormal()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Normal")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub

Sub FieldStyleHead1()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Heading 1")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub

Sub FieldStyleHead2()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Heading 2")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub
 
A

AnttiK

Hi Antti,
I assume you're working with Word 2003, since the formatting
restrictions first appeared in that version. The following method
works in all versions back to Word 2000 (maybe 97, I'm not sure)
because it doesn't depend on the restriction -- it's just that your
template will supply the only methods of changing the style in text
fields, and you supply only the styles you want.

When the form is protected, Word disables all methods of changing the
style, through dialogs, shortcuts, and VBA. The solution is to use VBA
to unprotect the document, change the style, and then restore the
protection, all in one operation.

You can place macros like these in your template (you may need to
change the names of the styles, as these aren't constant from one
language version to another). Also create toolbar buttons and/or
keyboard shortcuts to make it easy to call the macros.

Sub FieldStyleNormal()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Normal")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub

Sub FieldStyleHead1()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Heading 1")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub

Sub FieldStyleHead2()
Dim SaveRange As Range
Set SaveRange = Selection.Range
ActiveDocument.Unprotect
Selection.Paragraphs(1).Range.Style = _
ActiveDocument.Styles("Heading 2")
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
SaveRange.Select
End Sub

Hi Jay and Suzanne.

Thank you a lot for your answers. I'd like to try that way where I don't use
VBA. I don't have experience of VBA. Yes I know it's basic language, but
still I don't have time to learn it.

If you have this kind of problem, how you solve that without VBA? Is there a
way to limit useable styles, without protecting document? Can I lock only
some parts of document perhaps? I think the solution is very simple, but I
just don't get it.

Please help me a bit more...

-Antti
 
J

Jay Freedman

Hi Jay and Suzanne.

Thank you a lot for your answers. I'd like to try that way where I don't use
VBA. I don't have experience of VBA. Yes I know it's basic language, but
still I don't have time to learn it.

If you have this kind of problem, how you solve that without VBA? Is there a
way to limit useable styles, without protecting document? Can I lock only
some parts of document perhaps? I think the solution is very simple, but I
just don't get it.

Please help me a bit more...

-Antti

If I'm correct that you're using Word 2003 -- and if everyone who will
need to fill out your form also has 2003 -- you can use the new
protection feature it introduced.

Remove the form fields, and just leave spaces and/or paragraph marks
there as appropriate. In the Protect Document task pane, change the
Editing Restrictions from "Filling in forms" to "No change (Read
only)". Select each former form field area in turn and check the
Everyone box in the Exceptions part of the task pane. When you've done
all the areas, click the Start Enforcing button.

You can password-protect the settings if needed.

One main difference between this and form fields is that you can't use
the Tab key to navigate through the fields. Instead, the task pane has
buttons for "Find Next Region I Can Edit" and "Show All Regions I Can
Edit".
 
Top