Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Running "String" of Code

I'm wanting to run code that is generated as a string. For example, I've got
a class module called clsRecon with a property called "Name".

If I write the following code;

Dim aRecon as New clsRecon
aRecon.Name = "Bill"
debug.print aRecon.Name

then out prints Bill to the immediate window. What if I've passed string
variables so that Ive got the following

Dim aRecon as New clsRecon
Dim sType as String, sProperty as String
aRecon.Name = "Bill"
sType = "aRecon"
sProperty = "Name"

debug.print sType & "." & sProperty

of course... I'll just get "aRecon.Name"

how can I use the strings to get "Bill" instead.

Thanks,
Ryan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Running "String" of Code

you can directly call
Debug.print aRecon.Name
--
Regards,

Halim



"Hokievandal" wrote:

I'm wanting to run code that is generated as a string. For example, I've got
a class module called clsRecon with a property called "Name".

If I write the following code;

Dim aRecon as New clsRecon
aRecon.Name = "Bill"
debug.print aRecon.Name

then out prints Bill to the immediate window. What if I've passed string
variables so that Ive got the following

Dim aRecon as New clsRecon
Dim sType as String, sProperty as String
aRecon.Name = "Bill"
sType = "aRecon"
sProperty = "Name"

debug.print sType & "." & sProperty

of course... I'll just get "aRecon.Name"

how can I use the strings to get "Bill" instead.

Thanks,
Ryan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Running "String" of Code

Yea... but I want to generate the command aRecon.Name using strings passed to
a function. My problem is whether there's a way (like with application.run
for macros) to run a string as code.

Thanks,
Ryan

"Halim" wrote:

you can directly call
Debug.print aRecon.Name
--
Regards,

Halim



"Hokievandal" wrote:

I'm wanting to run code that is generated as a string. For example, I've got
a class module called clsRecon with a property called "Name".

If I write the following code;

Dim aRecon as New clsRecon
aRecon.Name = "Bill"
debug.print aRecon.Name

then out prints Bill to the immediate window. What if I've passed string
variables so that Ive got the following

Dim aRecon as New clsRecon
Dim sType as String, sProperty as String
aRecon.Name = "Bill"
sType = "aRecon"
sProperty = "Name"

debug.print sType & "." & sProperty

of course... I'll just get "aRecon.Name"

how can I use the strings to get "Bill" instead.

Thanks,
Ryan


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Running "String" of Code

perhaps you need this one:
just guessing:

Function nameof() as string
nameof = aRecon.Name
end function

--
Regards,

Halim



"Hokievandal" wrote:

Yea... but I want to generate the command aRecon.Name using strings passed to
a function. My problem is whether there's a way (like with application.run
for macros) to run a string as code.

Thanks,
Ryan

"Halim" wrote:

you can directly call
Debug.print aRecon.Name
--
Regards,

Halim



"Hokievandal" wrote:

I'm wanting to run code that is generated as a string. For example, I've got
a class module called clsRecon with a property called "Name".

If I write the following code;

Dim aRecon as New clsRecon
aRecon.Name = "Bill"
debug.print aRecon.Name

then out prints Bill to the immediate window. What if I've passed string
variables so that Ive got the following

Dim aRecon as New clsRecon
Dim sType as String, sProperty as String
aRecon.Name = "Bill"
sType = "aRecon"
sProperty = "Name"

debug.print sType & "." & sProperty

of course... I'll just get "aRecon.Name"

how can I use the strings to get "Bill" instead.

Thanks,
Ryan


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Running "String" of Code


"Hokievandal" wrote in message
...
Yea... but I want to generate the command aRecon.Name using strings passed
to
a function. My problem is whether there's a way (like with
application.run
for macros) to run a string as code.

Dim x As New Class1
x.name = "Owain"
Debug.Print CallByName(x, "name", VbGet)

HTH

Rob

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting "uppercase" string data to "lower case" in CSV file [email protected] Excel Discussion (Misc queries) 2 August 12th 08 08:36 PM
Running Custom Code if "Entire Workbook" is Selected for Printing rfedge Excel Programming 1 September 10th 06 06:12 AM
Stop code from running when I click "Cancel" Dean[_9_] Excel Programming 3 March 2nd 06 12:34 AM
"Casing" the strings for smooth code running Hari[_3_] Excel Programming 2 June 16th 04 04:41 PM
How can i write a vba code to get string or integer "C15" from $c$15? d Excel Programming 2 August 29th 03 06:11 PM


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"