View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Convert String variable to code

The short answer is no, you can't. The closest you can get is to use VBA to
write a new VBA Sub and then call that sub. If you structure things right,
and put the code in a class, you can use CallByName to execute a method of
the class.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Hokievandal" wrote in message
...
Hello all,
Is there a way to pass a string variable such as "textBox1.visible=true"
to
be read as code? I'm wanting to store short object properties within
control
tags to reduce code so that the program can loop through several text
boxes
and return values using the text in the control tag.

Simplified example;

dim Task as CustomObject
sProperty = textbox1.tag
msgbox("Custom Object Property = " & task.sProperty)

Thanks!