Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
sun tea sun tea is offline
external usenet poster
 
Posts: 5
Default TextBox in protected document

Hi

I have a document with two sections. The upper section has shapes on it and some controls that modify the shapes with VBA. The lower part of the document has a form on it and is protected for form editing only. I added a continuous section to separate the two sections of my form and have section 2 that has the form selected in the document protection.

I also have a text box in the Header of the document that is being changed with VBA when the shapes in the first section change. When I start protection on the document the text box in the header area is no longer editable.

I use the following code to change the text box in the header area.

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text = "some text"

When I protect the document applying protection to section 2 only this line of code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default TextBox in protected document

Editing is limited in a protected document; this includes any unprotected
sections. You probably have to unprotect and reprotect the document, which you
can do in code, before you can add text to the header.

By the way, to which header in which section is the text box anchored?

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi

I have a document with two sections. The upper section has shapes on it and
some controls that modify the shapes with VBA. The lower part of the document
has a form on it and is protected for form editing only. I added a continuous
section to separate the two sections of my form and have section 2 that has
the form selected in the document protection.

I also have a text box in the Header of the document that is being changed
with VBA when the shapes in the first section change. When I start protection
on the document the text box in the header area is no longer editable.

I use the following code to change the text box in the header area.

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text
= "some text"

When I protect the document applying protection to section 2 only this line of
code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
sun tea sun tea is offline
external usenet poster
 
Posts: 5
Default TextBox in protected document

Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section because the code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text boxes in the header and footer. I have the body of the of the document divided into two sections; one for displaying sets of shapes and one for a User Form.

Some of the shapes I have in the first section are in the story area (I think that is what it is called, the header type area behind the section) of the first section and the VBA code changes those shapes and text boxes just fine without unprotecting the document. It was just the text box in the header of the page/document that was being affected by the document protection.
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default TextBox in protected document

Are the headers unlinked? Otherwise, you have the same text box in both
sections, and that's probably what's causing the error message.

I'm not sure what you mean by "story area"; usually, the space for ordinary text
is called the "main body" and other areas, such as headers and footers, are
referred to as "story ranges" (at least that's the terminology in Word VBA).

Document protection should prevent users from changing content. Whenever you
want to enforce changes, using a macro that unprotects and reprotects the
document should work. In fact, that's the way it is done in a macro that enables
spell-checking in a protected document:
http://word.mvps.org/faqs/macrosvba/...ProtectDoc.htm.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section because the
code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text boxes in
the header and footer. I have the body of the of the document divided into
two sections; one for displaying sets of shapes and one for a User Form.

Some of the shapes I have in the first section are in the story area (I think
that is what it is called, the header type area behind the section) of the
first section and the VBA code changes those shapes and text boxes just fine
without unprotecting the document. It was just the text box in the header of
the page/document that was being affected by the document protection.

Also I would very much like to protect the header, footer, and story areas of
the document so they can not be accessed by the user. Is there any way of
doing that?

Thanks and Best Regards

Sun Tea

On Monday, June 25, 2012 9:19:31 AM UTC-5, Stefan Blom wrote:
Editing is limited in a protected document; this includes any unprotected
sections. You probably have to unprotect and reprotect the document, which
you
can do in code, before you can add text to the header.

By the way, to which header in which section is the text box anchored?

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi

I have a document with two sections. The upper section has shapes on it
and
some controls that modify the shapes with VBA. The lower part of the
document
has a form on it and is protected for form editing only. I added a
continuous
section to separate the two sections of my form and have section 2 that has
the form selected in the document protection.

I also have a text box in the Header of the document that is being changed
with VBA when the shapes in the first section change. When I start
protection
on the document the text box in the header area is no longer editable.

I use the following code to change the text box in the header area.

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text
= "some text"

When I protect the document applying protection to section 2 only this line
of
code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
sun tea sun tea is offline
external usenet poster
 
Posts: 5
Default TextBox in protected document


Yeah the using VBA to unprotect/protect worked to change the data in the text box. I am not quite sure what I am talking about either but basically I have only one page in the document and I used a continuous break to create the two sections in the document. The header area is being used to store data, graphics, and shapes and it extends the entire document to the footer. I had no trouble changing some of the shapes lines etc in the header area just the text box was giving me trouble.

Thanks so much for you help. Now also I see that the header/footer area is also not protected against editing.

Best Regards

Sun Tea



On Monday, June 25, 2012 2:34:50 PM UTC-5, Stefan Blom wrote:
Are the headers unlinked? Otherwise, you have the same text box in both
sections, and that's probably what's causing the error message.

I'm not sure what you mean by "story area"; usually, the space for ordinary text
is called the "main body" and other areas, such as headers and footers, are
referred to as "story ranges" (at least that's the terminology in Word VBA).

Document protection should prevent users from changing content. Whenever you
want to enforce changes, using a macro that unprotects and reprotects the
document should work. In fact, that's the way it is done in a macro that enables
spell-checking in a protected document:
http://word.mvps.org/faqs/macrosvba/...ProtectDoc.htm.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section because the
code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text boxes in
the header and footer. I have the body of the of the document divided into
two sections; one for displaying sets of shapes and one for a User Form..

Some of the shapes I have in the first section are in the story area (I think
that is what it is called, the header type area behind the section) of the
first section and the VBA code changes those shapes and text boxes just fine
without unprotecting the document. It was just the text box in the header of
the page/document that was being affected by the document protection.

Also I would very much like to protect the header, footer, and story areas of
the document so they can not be accessed by the user. Is there any way of
doing that?

Thanks and Best Regards

Sun Tea

On Monday, June 25, 2012 9:19:31 AM UTC-5, Stefan Blom wrote:
Editing is limited in a protected document; this includes any unprotected
sections. You probably have to unprotect and reprotect the document, which
you
can do in code, before you can add text to the header.

By the way, to which header in which section is the text box anchored?

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi

I have a document with two sections. The upper section has shapes on it
and
some controls that modify the shapes with VBA. The lower part of the
document
has a form on it and is protected for form editing only. I added a
continuous
section to separate the two sections of my form and have section 2 that has
the form selected in the document protection.

I also have a text box in the Header of the document that is being changed
with VBA when the shapes in the first section change. When I start
protection
on the document the text box in the header area is no longer editable.

I use the following code to change the text box in the header area.

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text
= "some text"

When I protect the document applying protection to section 2 only this line
of
code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
sun tea sun tea is offline
external usenet poster
 
Posts: 5
Default TextBox in protected document

It seem like the entire document is now protected and not just the section with the form on it. I selected the section with the form on it when protecting the document. Is there any way to restrict protection to just one section and also to just the header/footer area?

Thanks

Sun Tea

On Monday, June 25, 2012 7:44:14 PM UTC-5, sun tea wrote:
Yeah the using VBA to unprotect/protect worked to change the data in the text box. I am not quite sure what I am talking about either but basically I have only one page in the document and I used a continuous break to create the two sections in the document. The header area is being used to store data, graphics, and shapes and it extends the entire document to the footer. I had no trouble changing some of the shapes lines etc in the header area just the text box was giving me trouble.

Thanks so much for you help. Now also I see that the header/footer area is also not protected against editing.

Best Regards

Sun Tea



On Monday, June 25, 2012 2:34:50 PM UTC-5, Stefan Blom wrote:
Are the headers unlinked? Otherwise, you have the same text box in both
sections, and that's probably what's causing the error message.

I'm not sure what you mean by "story area"; usually, the space for ordinary text
is called the "main body" and other areas, such as headers and footers, are
referred to as "story ranges" (at least that's the terminology in Word VBA).

Document protection should prevent users from changing content. Whenever you
want to enforce changes, using a macro that unprotects and reprotects the
document should work. In fact, that's the way it is done in a macro that enables
spell-checking in a protected document:
http://word.mvps.org/faqs/macrosvba/...ProtectDoc.htm.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section because the
code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text boxes in
the header and footer. I have the body of the of the document divided into
two sections; one for displaying sets of shapes and one for a User Form.

Some of the shapes I have in the first section are in the story area (I think
that is what it is called, the header type area behind the section) of the
first section and the VBA code changes those shapes and text boxes just fine
without unprotecting the document. It was just the text box in the header of
the page/document that was being affected by the document protection.

Also I would very much like to protect the header, footer, and story areas of
the document so they can not be accessed by the user. Is there any way of
doing that?

Thanks and Best Regards

Sun Tea

On Monday, June 25, 2012 9:19:31 AM UTC-5, Stefan Blom wrote:
Editing is limited in a protected document; this includes any unprotected
sections. You probably have to unprotect and reprotect the document, which
you
can do in code, before you can add text to the header.

By the way, to which header in which section is the text box anchored?

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi

I have a document with two sections. The upper section has shapes on it
and
some controls that modify the shapes with VBA. The lower part of the
document
has a form on it and is protected for form editing only. I added a
continuous
section to separate the two sections of my form and have section 2 that has
the form selected in the document protection.

I also have a text box in the Header of the document that is being changed
with VBA when the shapes in the first section change. When I start
protection
on the document the text box in the header area is no longer editable.

I use the following code to change the text box in the header area..

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text
= "some text"

When I protect the document applying protection to section 2 only this line
of
code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
sun tea sun tea is offline
external usenet poster
 
Posts: 5
Default TextBox in protected document

Actually from what I can see the form section is locked for form editing only and the first section is open for editing except the shapes are locked and can not be selected or deleted. Also the header/footer area is locked. So I think this is close to what I am looking for.

Thanks for your help.

Sun Tea


On Monday, June 25, 2012 7:49:59 PM UTC-5, sun tea wrote:
It seem like the entire document is now protected and not just the section with the form on it. I selected the section with the form on it when protecting the document. Is there any way to restrict protection to just one section and also to just the header/footer area?

Thanks

Sun Tea

On Monday, June 25, 2012 7:44:14 PM UTC-5, sun tea wrote:
Yeah the using VBA to unprotect/protect worked to change the data in the text box. I am not quite sure what I am talking about either but basically I have only one page in the document and I used a continuous break to create the two sections in the document. The header area is being used to store data, graphics, and shapes and it extends the entire document to the footer. I had no trouble changing some of the shapes lines etc in the header area just the text box was giving me trouble.

Thanks so much for you help. Now also I see that the header/footer area is also not protected against editing.

Best Regards

Sun Tea



On Monday, June 25, 2012 2:34:50 PM UTC-5, Stefan Blom wrote:
Are the headers unlinked? Otherwise, you have the same text box in both
sections, and that's probably what's causing the error message.

I'm not sure what you mean by "story area"; usually, the space for ordinary text
is called the "main body" and other areas, such as headers and footers, are
referred to as "story ranges" (at least that's the terminology in Word VBA).

Document protection should prevent users from changing content. Whenever you
want to enforce changes, using a macro that unprotects and reprotects the
document should work. In fact, that's the way it is done in a macro that enables
spell-checking in a protected document:
http://word.mvps.org/faqs/macrosvba/...ProtectDoc.htm.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section because the
code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text boxes in
the header and footer. I have the body of the of the document divided into
two sections; one for displaying sets of shapes and one for a User Form.

Some of the shapes I have in the first section are in the story area (I think
that is what it is called, the header type area behind the section) of the
first section and the VBA code changes those shapes and text boxes just fine
without unprotecting the document. It was just the text box in the header of
the page/document that was being affected by the document protection.

  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default TextBox in protected document

I'm glad you got it sorted.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Actually from what I can see the form section is locked for form editing only
and the first section is open for editing except the shapes are locked and can
not be selected or deleted. Also the header/footer area is locked. So I
think this is close to what I am looking for.

Thanks for your help.

Sun Tea


On Monday, June 25, 2012 7:49:59 PM UTC-5, sun tea wrote:
It seem like the entire document is now protected and not just the section
with the form on it. I selected the section with the form on it when
protecting the document. Is there any way to restrict protection to just one
section and also to just the header/footer area?

Thanks

Sun Tea

On Monday, June 25, 2012 7:44:14 PM UTC-5, sun tea wrote:
Yeah the using VBA to unprotect/protect worked to change the data in the
text box. I am not quite sure what I am talking about either but
basically I have only one page in the document and I used a continuous
break to create the two sections in the document. The header area is being
used to store data, graphics, and shapes and it extends the entire document
to the footer. I had no trouble changing some of the shapes lines etc in
the header area just the text box was giving me trouble.

Thanks so much for you help. Now also I see that the header/footer area is
also not protected against editing.

Best Regards

Sun Tea



On Monday, June 25, 2012 2:34:50 PM UTC-5, Stefan Blom wrote:
Are the headers unlinked? Otherwise, you have the same text box in both
sections, and that's probably what's causing the error message.

I'm not sure what you mean by "story area"; usually, the space for
ordinary text
is called the "main body" and other areas, such as headers and footers,
are
referred to as "story ranges" (at least that's the terminology in Word
VBA).

Document protection should prevent users from changing content. Whenever
you
want to enforce changes, using a macro that unprotects and reprotects the
document should work. In fact, that's the way it is done in a macro that
enables
spell-checking in a protected document:
http://word.mvps.org/faqs/macrosvba/...ProtectDoc.htm.

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi Stephen

Thank you so much for your reply.
Unprotecting the document with Code worked.

I am guessing the text box is in the header of the first section
because the
code to change it is ActiveDocument.Sections(1).Headers ...

Basically what I have is a one page document with graphics and text
boxes in
the header and footer. I have the body of the of the document divided
into
two sections; one for displaying sets of shapes and one for a User
Form.

Some of the shapes I have in the first section are in the story area (I
think
that is what it is called, the header type area behind the section) of
the
first section and the VBA code changes those shapes and text boxes just
fine
without unprotecting the document. It was just the text box in the
header of
the page/document that was being affected by the document protection.

Also I would very much like to protect the header, footer, and story
areas of
the document so they can not be accessed by the user. Is there any way
of
doing that?

Thanks and Best Regards

Sun Tea

On Monday, June 25, 2012 9:19:31 AM UTC-5, Stefan Blom wrote:
Editing is limited in a protected document; this includes any
unprotected
sections. You probably have to unprotect and reprotect the document,
which
you
can do in code, before you can add text to the header.

By the way, to which header in which section is the text box anchored?

--
Stefan Blom
Microsoft Word MVP





"sun tea" wrote in message
...
Hi

I have a document with two sections. The upper section has shapes
on it
and
some controls that modify the shapes with VBA. The lower part of
the
document
has a form on it and is protected for form editing only. I added a
continuous
section to separate the two sections of my form and have section 2
that has
the form selected in the document protection.

I also have a text box in the Header of the document that is being
changed
with VBA when the shapes in the first section change. When I start
protection
on the document the text box in the header area is no longer
editable.

I use the following code to change the text box in the header area.

ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary).Shapes(TITLE_TEXT_BOX_NAME).TextFrame.Text Range.Text
= "some text"

When I protect the document applying protection to section 2 only
this line
of
code generates an error saying the document is protected.

Any help would be appreciated.

Thanks

Sun Tea


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I get a textbox to repeat on every page of a document? Buffy Page Layout 5 May 4th 23 02:53 PM
how to add textbox in protected document Arjun Microsoft Word Help 2 April 8th 10 01:33 PM
how to add textbox in protected document Arjun Microsoft Word Help 0 April 8th 10 12:46 PM
How do I jump from textbox to textbox within a page? Pimm Microsoft Word Help 2 February 25th 09 08:16 PM
Textbox loses "Default Result" when doc Protected zSplash Formatting Long Documents 2 March 30th 05 06:47 PM


All times are GMT +1. The time now is 03:02 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"