View Single Post
  #4   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman
 
Posts: n/a
Default Validating checkbox values in MS Word

Off the top of my head, it *should* be possible to handle the fields
in tables. I just don't have time right now to test the code.

First, I'm making the assumption that the Yes and No check boxes for
the same question are always in the same row of a table.

The idea is this: At the beginning of the MakeCheckBoxesExclusive
macro, use

RowNum = Selection.Information(wdEndOfRangeRowNumber)

to find out which table row contains the check box that was just
clicked. Then replace the line

For Each oField In Selection.Frames(1).Range.FormFields

in the code of the article with the line

For Each oField In Selection.Tables(1).Row(RowNum).Range.FormFields

This should uncheck both boxes in that one row, and then the macro
checks the box that was just clicked. Although it may seem confusing,
the expression Selection.Tables(1) refers to the first (and only)
table in the Selection, not to the first table in the document.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 12:26:11 -0700, wrote:

Jay:

Thanks so much for the reference.

Is there any way to do this in code? The reason being is that I have
my form set up in a table and have some other code hiding and unhiding
text in table cells based upon a selection the user makes in the form.
This text that is hiding and unhiding also has Yes/No fields associated
with it, so you see why I need to leave it in a table. If I take
everything out of tables then I need to rewrite the code I currently
have for the other form operation.

Debbie

Jay Freedman wrote:
See
http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 07:42:50 -0700, wrote:

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!