通过复选框输入执行宏

Perform a macro by Checkbox Input

我有 Check-Boxes,带有国家名称的标题和 User-form 上的 OK 按钮,

用户将 Mark 要求 Check-Boxes 并单击 OK 提交表单。

预期结果: 对于每个选中的 Box,都有一个 Macro 需要执行。

如何让 OK 按钮在用户 Check-Marked 的选定国家/地区执行宏?

下面的代码是否正确处理了这种情况?或者还有其他方法吗?

If ActiveDocument.CeemeaFinallist.EasternEurope("CheckBox1").CheckBox.Value = True Then
Application.Run MacroName:="Normal.NewMacros.CEEMEA2"
Else
End If

如何一次 Select all Check-Boxes

尝试遍历控件并触发复选框设置为 True 的宏:

Private Sub CommandButton1_Click()
Dim ctl As Control
Dim j As Long
For Each ctl In Me.Controls
    If TypeOf ctl Is MSForms.CheckBox Then
        If Me.Controls(ctl.Name).Value = True Then
            ' Fire macro with ctl.Caption to identify the country
        End If
    End If
Next    
End Sub