I have another problem, which I can't solve. This time it refers to option buttons.
I have one group of two buttons (YES and NO) and I have three more groups of one button each. The idea is, if it is NO button "on", then all tree groups should have property "Enabled" value "false". Basically, they should be blocked. If it is YES button "on", then all tree groups should have property "Enabled" value "true". All tree groups should be "on" or "off" depending on whether I click on them and how many times. Those three buttons are independent and can be in combinations with each other "on" or "off".
i tried with the code:
Private Sub V1028_Click()
Dim E As Shape
If ActiveDocument.Shapes(91) = True Then
Set E = ActiveDocument.Shapes(96)
E.Visible = True
Set E = ActiveDocument.Shapes(97)
E.Visible = True
Set E = ActiveDocument.Shapes(98)
E.Visible = True
End If
End Sub
I got information "Object doesn't support this property or method"!
Can someone help me? Thanks in advance!
CheckBox
instead of an OptionButton
achieve the following:All three groups should be "on" or "off" depending on whether I click on them and how many times
OptionButton1
Option Explicit
' OptionButton1 change event code
Private Sub OptionButton1_Change()
Dim ctl As InlineShape
Dim i As Long, ctlName As Long, opVal As Boolean
Const CTL_TYPE = "CheckBox"
For Each ctl In ActiveDocument.InlineShapes
With ctl.OLEFormat.Object
If .Name = "OptionButton1" Then
opVal = .Value
Exit For
End If
End With
Next
For Each ctl In ActiveDocument.InlineShapes
With ctl.OLEFormat
If ctl.Type = wdInlineShapeOLEControlObject Then
If TypeName(.Object) = CTL_TYPE Then
.Object.Object.Enabled = opVal
End If
End If
End With
Next
End Sub
Microsoft documentation: