Put variable in UserForm name

projektalex

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?

ashareef

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]

編集
0

コメントを追加

0

関連記事

分類Dev

Move value from one UserForm to another (variable) UserForm

分類Dev

ruby code: why put colon in front of variable name (inside initialize method)

分類Dev

Put variable into FOR..IN

分類Dev

Calling value inside a Userform's Control using a variable

分類Dev

How do I put all the text after the name of my command and the prefix into a variable like rest_of_message in the async def?

分類Dev

How to put variable as argument in system()

分類Dev

Put the loop variable into an attribute of a template

分類Dev

Put a variable in the title of the console (Python)

分類Dev

traefik - Put variable into docker label

分類Dev

Put jQuery variable in css gradient

分類Dev

How to put a variable inside cURL?

分類Dev

Variable string inside variable name

分類Dev

SCSS variable class name

分類Dev

SCSS variable class name

分類Dev

SCSS variable class name

分類Dev

Concatenate variable and function name

分類Dev

Variable name not found

分類Dev

Compare variable name to a string

分類Dev

String to variable name Haskell

分類Dev

Unexpected token in variable name

分類Dev

variable `-name` primary to `find`

分類Dev

how to put name and date beside image

分類Dev

How to put input of a function in the name of text file?

分類Dev

Put "Execute statement" result into variable in MySQL

分類Dev

How to put the value of an entry into a variable in tkinter

分類Dev

how to put char * argv[] to global variable

分類Dev

Python class variable name vs __name__

分類Dev

Can class name and variable name be same in java?

分類Dev

shows undefined variable when changing the variable name

Related 関連記事

ホットタグ

アーカイブ