Re: count the value of Optionbox in a table by Greg
Greg
Thu Aug 10 21:00:39 CDT 2006
Frogman,
Thanks to some great detective work by Jay Freedman, I think I can
offer some help.
If you name all of your Pass optionbuttons Pass1, Pass2, etc. and the
Fail buttons Fail1, Fail 2, etc. then you could get a count of the
active buttons of each type using something like:
Sub CountSelectedOptionBoxes()
Dim ctl As InlineShape
Dim i As Double
Dim j As Double
For Each ctl In ActiveDocument.InlineShapes
If ctl.Type = wdInlineShapeOLEControlObject Then
If InStr(ctl.OLEFormat.Object.Name, "Pass") > 0 Then
i = i + ctl.OLEFormat.Object.Value
ElseIf InStr(ctl.OLEFormat.Object.Name, "Fail") > 0 Then
j = j + ctl.OLEFormat.Object.Value
End If
End If
Next
MsgBox "Pass: " & -i & "Fail: " & -j
End Sub
frogman wrote:
> I got that to work the reason I wanted to use Optionsboxes is that I
> want to total the fields if one of the pass fail it changed.