简体   繁体   中英

Referencing Excel Userform Control Name Value From String (VBA)

Typically when referencing a userform control value in Excel VBA I would enter something to the effect of radiobutton.value

However, I want to be able to use a string as the name of the user control. The idea behind this would be to dynamically be able to generate the control name and reference a value from it.

For example I may want to reference ctradiobutton.value one time, and etradiobutton.value the next, these controls already exist on the form, I just want to reference a different name of the control from a string created on the current iteration.

像这样( Me是用户窗体)

Me.Controls("TextBox1").Value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM