I have following code in a subfunction:
If Auswertung.Controls("T" & Te & "F" & Fr & "Option1").Value = False Then
falseSelection = falseSelection + 1
end If
If Auswertung2.Controls("T" & Te & "F" & Fr & "Option1").Value = False Then
falseSelection = falseSelection + 1
end If
There are 15 UserForms, so I need to use a variable for the UserForm name.
"Auswertung" & X & .Controls("T" & Te & "F" & Fr & "Option1").Value
(This is wrong, but I do not know which capabilites VBA has)
Is there a way to accomplish this?
Access VBA
This is how you loop through all the forms of a project. In your case you can modify it to be stored in a variable and then run a check on .Name
to see if it matches the form you need
Dim f
For Each f In CurrentProject.AllForms
Debug.Print f.Name
Next
OR you can simply refer to a form by its name in the following way
Forms.Item("Auswertung" & X).Controls
Excel VBA
Dim f As Object
For Each f In VBA.UserForms
Debug.Print f.Name
Next
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加