-1

Suppose my class has a couple of similar properties and I want to select one dynamically based on a string variable:

MyClass properties:
PropertyOne
PropertyTwo

Some generic code:
myString = "One"
MyClass.Property & myString = "blah" 'this doesn't work

Community
  • 1
  • 1

1 Answers1

0
CallByName MyClass, "PropertyOne", vbLet, "blah"

https://msdn.microsoft.com/VBA/Language-Reference-VBA/articles/callbyname-function

Slai
  • 22,144
  • 5
  • 45
  • 53