Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Style of Formfield gets lost on Protecting Document.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Murali - 03 Jan 2007 05:19 GMT
I have created a simple form field like this:
Name (Style - 'TemplateLabel' ) :  {FormField} (Style = 'Title1')

The style of form field ('Title1') is available when the document is in
UnProtected Mode.  The Problem is the Style of formfield gets changed to
'TemplateLabel' on changing the document to Protected Mode.

Following is the code is invoked dynamically on click of a Command Button:

Private Sub GalleryImages_Click()
   ActiveDocument.Unprotect Password:=""
   Selection.TypeText Text:="Title" & vbTab & vbTab
   Selection.Style = ActiveDocument.Styles("TemplateLabel")

   Selection.FormFields.Add Range:=Selection.Range, Type:= _
       wdFieldFormTextInput
           
   With Selection.FormFields(1)
       .Name = "Title1"
      End With
  Selection.Style = ActiveDocument.Styles("Title1")
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset:=True
End Sub

Can anybody help to let know why the formfield style gets changed on
Protecting the document?

Thanks for your help
Murali
Cindy M. - 03 Jan 2007 16:05 GMT
Hi =?Utf-8?B?TXVyYWxp?=,

Which version of Word are we dealing with?

Is "Title1" a character style, or a paragraph style?

Is the text and formfields in a table?

> I have created a simple form field like this:
> Name (Style - 'TemplateLabel' ) :  {FormField} (Style = 'Title1')
[quoted text clipped - 22 lines]
> Can anybody help to let know why the formfield style gets changed on
> Protecting the document?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Murali - 04 Jan 2007 03:40 GMT
Thanks for looking into the issue.
1. We are using Word 2003.  
2. The style of the label ("Name") is of type character and of the form
field ("Title1") is Paragraph.
3. The text & form fields are not in a table.

Look forward your reply, Murali

> Hi =?Utf-8?B?TXVyYWxp?=,
>
[quoted text clipped - 38 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M. - 09 Jan 2007 17:57 GMT
Hi Murali,

> 1. We are using Word 2003.  
> 2. The style of the label ("Name") is of type character and of the form
> field ("Title1") is Paragraph.
> 3. The text & form fields are not in a table.

See if this KB article applies to your situation. The behavior you
describe seems to indicate it:

Incorrect Font Is Applied After a Style Is Applied to a Form Field
ID: 828501
http://support.microsoft.com/default.aspx?scid=kb;en-us;828501

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.