Is this possible ? Adding Checkboxex in to a table cell with VBA

D

De Vo

I am creating a template which is basically a table.

I want to know if it is possible when adding a row to my table to
basically populate a cell with a check box, this will be happening for
every row added. No bookmark is required as i scan the rows for the
state of the checkbox on calculation stage

I have been trying to do this .. and been using form fields..but cant
see my checkbox appear...

can some one point me in the right direction or syntax for the command
i need to use

many thanks to all who read / reply

de vo
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

The following works for me:

Sub addrow()
'
' Macro created 02/02/03 by Doug Robbins
' To add a new row to a table containing Checkbox formfields in every column
' automatically on exit from the last cell in the present last row of the
table
Dim rownum As Integer, i As Integer
ActiveDocument.Unprotect
ActiveDocument.Tables(1).Rows.Add
rownum = ActiveDocument.Tables(1).Rows.Count
For i = 1 To ActiveDocument.Tables(1).Columns.Count
ActiveDocument.FormFields.Add
Range:=ActiveDocument.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormCheckBox
Next i
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.FormFields(1).ExitMacro =
"addrow"
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
1).Range.FormFields(1).Select
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top