依赖组合框

时间:2019-12-20 21:43:55

标签: vba ms-word

我想要一个Word文档,其中包含2个组合框。 Combobox1将具有一个选择,第二个将根据Combobox1的选择进行填充。

以下代码执行旧版控件样式,但我需要活动的x组合框。我也有一个约束,要求必须能够在单词doc中输入注释,并且限制表单字段会禁用此功能(为什么传统样式无法使用)。

   Sub Dropdowns()
    Dim xDirection As FormField
    Dim xState As FormField
    On Error Resume Next
    Set xDirection = ActiveDocument.FormFields("QSystem")
    Set xState = ActiveDocument.FormFields("FType")
    If ((xDirection Is Nothing) Or (xState Is Nothing)) Then Exit Sub
    With xState.DropDown.ListEntries
        .Clear
        Select Case xDirection.Result
            Case "Type1"
.Add "SubType1"
.Add "SubType2"
              Case "Production and In-Process Controls"
.Add "SubType3"
.Add "SubType4"
                 End Select
    End With
End Sub

0 个答案:

没有答案
相关问题