我正在使用Excel中的MultiPage控件创建一个向导。
它有4页,我想验证每一页的数据。
对于第2页,我正在验证文本框,确保它们不会被以下代码所空:
Private Sub validaPasso2()
Dim cCont As Control
For Each cCont In Me.Controls
If TypeOf cCont Is MSForms.TextBox Then
If cCont.Value = vbNullString Then
MsgBox "caixa vazia"
End If
End If
Next
End Sub但是,这是在检查表单中的所有文本框,我只想检查Page2。所以,与For Each cCont In Me.Controls不同,我如何表达对Each cCont In Me.Controls in Page2 only的理解
发布于 2014-07-01 18:38:10
Private Sub CommandButton1_Click()
Dim cCont As Control
For Each cCont In Me.MultiPage1.Pages(0).Controls
If TypeName(cCont) = "TextBox" Then
'DO STUFF HERE
End If
Next cCont
End Sub发现这里
https://stackoverflow.com/questions/24515675
复制相似问题