Operate on All specified controls on Windows Form using VBA

This code snippet is designed to check the value of all textboxes in windows user form, and if it’s equal to nothing, the counter will add an increment.

Dim vacF As Integer 
Dim pressure As Single
Dim temperature As Single
Dim volume As Single
Dim moles As Single
Dim obj As Control
Dim objName As String

vacF = 0

For Each obj In EOS.Controls
    If UCase(TypeName(obj)) = "TEXTBOX" Then
        If obj.Text = "" Then
        vacF = vacF + 1
        objName = obj.Name
        End If
    End If
Next obj

Leave a Reply

Your email address will not be published. Required fields are marked *