Check box question

S

Steve C

I am setting up a Word template with a two column table (about 30 rows). In
each cell in the first column, I'm using the Control Box toolbar to insert a
checkbox. The second column contains various legal statements. I would like
the user to be able to check any of the desired statements he/she wishes to
include in the document they're printing.

Once they are done checking off what they want included, I tried creating an
Update command button on the document which, when clicked, searches which
checkboxes are checked. If unchecked, delete the whole row so it doesn't
print (that works fine). If checked, keep the statement but delete/hide only
the checkbox for printing purposes (I can't get this to work). This is the
code I tried for the first checkbox:

Private Sub cmdUpdate_Click()

' If checkbox not checked, go to bookmark in first row and delete entire
row
If chkBox1.Value = False Then
Selection.GoTo What:=wdGoToBookmark, Name:="Row1Text"
Selection.SelectRow
Selection.Rows.Delete

ElseIf chkBox1.Value = True Then
ActiveDocument.ToggleFormsDesign ' toggle on Design mode
Selection.GoTo What:=wdGoToBookmark, Name:="Row1Text"
Selection.Delete Unit:=wdCharacter, Count:=1 'delete Checkbox cell
contents
ActiveDocument.ToggleFormsDesign ' toggle off Design mode
End If
End Sub

Am I making this too hard? Any suggestions would be appreciated! Thanks.

Steve C
 
D

Dawn Crosier

One caution I would like to impart is that using tools from the Control
Toolbox can cause you problems if you use many of them. The tools are
ActiveX controls and are very "heavy" in the document. Think big
graphic multiplied by however many objects.

An alternative solution is to create a UserForm which contains your
options. When the OK button is clicked, the approved text can be
inserted in your document. You can even make your template more robust
for your paralegals by inserting the text into the standard basic text
inside of bookmarks. See
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=15 or
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=216 and
http://www.mousetrax.com/TechPage.html#autoforms (especially the series
on "Please fill out this form"

However, if you like the way you are going now, then I would try either
of the below solutions.

Since you have been able to get the delete Row feature to work, why not
delete the column containing the checkboxes?

Selection.SelectColumn
Selection.Columns.Delete

Or you could format the text of the column to be hidden.

Selection.SelectColumn
With Selection.Font
.Hidden = True
End With

--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.

|I am setting up a Word template with a two column table (about 30
rows). In
| each cell in the first column, I'm using the Control Box toolbar to
insert a
| checkbox. The second column contains various legal statements. I
would like
| the user to be able to check any of the desired statements he/she
wishes to
| include in the document they're printing.
|
| Once they are done checking off what they want included, I tried
creating an
| Update command button on the document which, when clicked, searches
which
| checkboxes are checked. If unchecked, delete the whole row so it
doesn't
| print (that works fine). If checked, keep the statement but
delete/hide only
| the checkbox for printing purposes (I can't get this to work). This is
the
| code I tried for the first checkbox:
|
| Private Sub cmdUpdate_Click()
|
| ' If checkbox not checked, go to bookmark in first row and delete
entire
| row
| If chkBox1.Value = False Then
| Selection.GoTo What:=wdGoToBookmark, Name:="Row1Text"
| Selection.SelectRow
| Selection.Rows.Delete
|
| ElseIf chkBox1.Value = True Then
| ActiveDocument.ToggleFormsDesign ' toggle on Design mode
| Selection.GoTo What:=wdGoToBookmark, Name:="Row1Text"
| Selection.Delete Unit:=wdCharacter, Count:=1 'delete Checkbox
cell
| contents
| ActiveDocument.ToggleFormsDesign ' toggle off Design mode
| End If
| End Sub
|
| Am I making this too hard? Any suggestions would be appreciated!
Thanks.
|
| Steve C
 

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