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 / March 2008

Tip: Looking for answers? Try searching our database.

Tables in Protected Documents

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed - 17 Mar 2008 19:59 GMT
How do I allow people to expand a table in a protected document that I
created in Word 2003?
Jean-Guy Marcil - 17 Mar 2008 21:01 GMT
> How do I allow people to expand a table in a protected document that I
> created in Word 2003?

Do you mean expand a row in a table (so its height is increased and users
can add text to that row) or expand the table by adding rows to it (With
formfields so users can write in those new rows)?
Ed - 17 Mar 2008 22:07 GMT
Yes. Some users will need to increase the height of the table in order to add
additional lines of information into the table.

> > How do I allow people to expand a table in a protected document that I
> > created in Word 2003?
>
> Do you mean expand a row in a table (so its height is increased and users
> can add text to that row) or expand the table by adding rows to it (With
> formfields so users can write in those new rows)?
Doug Robbins - Word MVP - 18 Mar 2008 01:01 GMT
Assuming that the users are wanting to increase the height of the table by
adding additional rows and that in those rows, it will be necessary to have
formfields, you will need something like the following macro run on exit
from the last formfield in the last row.

Dim rownum As Integer, i As Integer
With ActiveDocument
   .Unprotect
   .Tables(1).Rows.Add
   rownum = .Tables(1).Rows.Count
   For i = 1 To 3
       .FormFields.Add Range:=.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput
   Next i
   .FormFields.Add Range:=.Tables(1).Cell(rownum, 4).Range,
Type:=wdFieldFormDropDown
   With .Tables(1).Cell(rownum, 4).Range.FormFields(1).DropDown.ListEntries
       .Add "Item1"
       .Add "Item2"
       .Add "Item3"
       .Add "Item4"
       .Add "Item5"
   End With
   .FormFields.Add Range:=.Tables(1).Cell(rownum, 5).Range,
Type:=wdFieldFormDropDown
   With .Tables(1).Cell(rownum, 5).Range.FormFields(1).DropDown.ListEntries
       .Add "ItemA"
       .Add "ItemB"
       .Add "ItemC"
       .Add "ItemD"
       .Add "ItemE"
   End With
   .Tables(1).Cell(rownum, 5).Range.FormFields(1).ExitMacro = "addrow"
   .Tables(1).Cell(rownum, 1).Range.FormFields(1).Select
   .Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With

This macro was set up for a 5 column table, with text formfields in the
first three cells of each row and dropdown formfields in the fourth and
fifth cells.  You will need to modify it to suit your requirements.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Yes. Some users will need to increase the height of the table in order to
> add
[quoted text clipped - 6 lines]
>> can add text to that row) or expand the table by adding rows to it (With
>> formfields so users can write in those new rows)?
 
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.