Procházením kolekce Controls Např. kontrola textboxů ve formuláři a zobrazit msgbox s názvy prázdných Přidat do referencí: Microsoft Forms 2.0 Object Library 've formuláři (UserForm)
Private Sub CommandButton_Click()
CheckTextBoxesInForm Me
End Sub
'v modulu
Sub CheckTextBoxesInForm(f As UserForm)
Dim c As Control
Dim msg As String
For Each c In f.Controls
If TypeName(c) = "TextBox" Then
Dim tb As MSForms.TextBox
Set tb = c
If tb.Value = vbNullString Then
msg = IIf(msg = "", "", msg & vbCrLf)
msg = msg & tb.Name & ".Value = vbNullString"
End If
End If
Next
If msg <> "" Then MsgBox msg
End Sub
|