View Single Post
 
Old 05-30-2016, 05:15 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I would be trying to design a way of tagging each checkbox with the expected value. For instance, the macro loops across all the checkboxes to check if, in each case, the value matches the tag.
I think the only way to tag a legacy form checkbox is to use its bookmark value. For instance, you could set the bookmark values of Q1a0, Q1b0, Q1c1, Q1d0 such that the last character tells you which one(s) need to be true. Then the loop can compare the checkbox values to this information and arrive at the correct/incorrect decision. For example the following code
Code:
Sub CheckCbs()
  Dim aFF As FormField, bAnswer As Boolean
  bAnswer = True
  For Each aFF In ActiveDocument.FormFields
    Debug.Print aFF.Range.Bookmarks(1).Name, Right(aFF.Range.Bookmarks(1).Name, 1) = aFF.CheckBox.Value
    bAnswer = bAnswer And Right(aFF.Range.Bookmarks(1).Name, 1) = aFF.CheckBox.Value
  Next aFF
  MsgBox bAnswer
End Sub
If you put each set of check boxes into their own table cell then you could adjust the macro to interrogate only the current cell range which would enable every checkbox macro to use the same code each time.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote