ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Convert String variable to code (https://www.excelbanter.com/excel-programming/379198-re-convert-string-variable-code.html)

Bob Phillips

Convert String variable to code
 
Surely

sProperty = textbox1.tag
msgbox("Custom Object Property = " & sProperty)

gets what you want?


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"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!




Bob Phillips

Convert String variable to code
 
Is the user input the control name? If so,

MsgBox Me.Controls(sStringCommand).Left

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Hokievandal" wrote in message
...
I didn't state my question very well. Instead, how could i make the
following work?
Dim sStringCommand as String

sStringCommand = "msgbox("Enter Name:")
call sStringCommand and have the code 'MsgBox... ' run

Thanks again,
Ryan



"Bob Phillips" wrote:

Surely

sProperty = textbox1.tag
msgbox("Custom Object Property = " & sProperty)

gets what you want?


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"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!








All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com