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 / November 2005

Tip: Looking for answers? Try searching our database.

Check box question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve C - 29 Nov 2005 21:52 GMT
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
Dawn Crosier - 30 Nov 2005 19:02 GMT
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

Signature

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
[quoted text clipped - 30 lines]
|
| Steve C
Steve C - 30 Nov 2005 21:58 GMT
Dawn,

I will give your ideas a look.  Thanks a ton!

> 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
[quoted text clipped - 73 lines]
> |
> | Steve C

Rate this thread:






 
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.