Prev: Content select question?
Next: Thumbnails not showing
From: Gazza on 2 Jun 2010 04:19 Firstly apologies if this is the incorrect forum but I was looking for a general word forum and could not find one. Please point me to one if one exists. I am trying to create a form where I want to specify what items need to be filled in. (Review minutes from design reviews). I want to make certain fields mandatory like the date, attendees and check list used and want to block saving of the document with a warning until they are filled in. Is there a way of doing this? Also as a part of the review actions are filled in to a table. depending on how many actions there are the table may be large or small so I really want to allow edits to the table so that rows can be added or deleted and text can just be written to it. However when I protect the form the table becomes locked unless I add fields to each cell of the table. Is thee a way of stopping the table itself from being locked when the document is protected? Many thanks in advance. Gary
From: Doug Robbins - Word MVP on 2 Jun 2010 05:00 Running a macro containing the following code on exit from the last formfield in the table will add a row to the table containing formfields in each cell: 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 The macro as set up is for a five column table and it inserts Text FormFields into the first three cells of the new row and DropDown FormField in each of the fourth and fifth columns. Modify the code for your circumstances. For dealing with the requirement that the formfields be completed, see the article "How to validate the contents of a formfield in a Word form" at: http://www.word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm -- 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, originally posted via msnews.microsoft.com "Gazza" <gary_windsor(a)hotmail.com> wrote in message news:bd4b0143-76c2-4f41-9b49-a132d537e82c(a)q33g2000vbt.googlegroups.com... > Firstly apologies if this is the incorrect forum but I was looking for > a general word forum and could not find one. Please point me to one if > one exists. > > I am trying to create a form where I want to specify what items need > to be filled in. (Review minutes from design reviews). I want to make > certain fields mandatory like the date, attendees and check list used > and want to block saving of the document with a warning until they are > filled in. Is there a way of doing this? > > Also as a part of the review actions are filled in to a table. > depending on how many actions there are the table may be large or > small so I really want to allow edits to the table so that rows can be > added or deleted and text can just be written to it. However when I > protect the form the table becomes locked unless I add fields to each > cell of the table. Is thee a way of stopping the table itself from > being locked when the document is protected? > > Many thanks in advance. > > Gary
From: Graham Mayor on 2 Jun 2010 05:00 If the document is to allow free editing then a protected form is not the answer. Use instead a userform to gather and validate the data and build the table - For the basics, see Word MVP FAQ - Userforms http://word.mvps.org/FAQs/Userforms.htm for a more in depth explanation, see http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm However it is certainly possible to validate form fields - http://www.gmayor.com/formfieldmacros.htm and it is also possible to add rows to a protected table (I would suggest not removing rows from a table as that adds unnecessarily to the complexity) and there are examples of code to do that at http://www.gmayor.com/word_vba_examples.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Gazza" <gary_windsor(a)hotmail.com> wrote in message news:bd4b0143-76c2-4f41-9b49-a132d537e82c(a)q33g2000vbt.googlegroups.com... > Firstly apologies if this is the incorrect forum but I was looking for > a general word forum and could not find one. Please point me to one if > one exists. > > I am trying to create a form where I want to specify what items need > to be filled in. (Review minutes from design reviews). I want to make > certain fields mandatory like the date, attendees and check list used > and want to block saving of the document with a warning until they are > filled in. Is there a way of doing this? > > Also as a part of the review actions are filled in to a table. > depending on how many actions there are the table may be large or > small so I really want to allow edits to the table so that rows can be > added or deleted and text can just be written to it. However when I > protect the form the table becomes locked unless I add fields to each > cell of the table. Is thee a way of stopping the table itself from > being locked when the document is protected? > > Many thanks in advance. > > Gary
|
Pages: 1 Prev: Content select question? Next: Thumbnails not showing |