vba equivilant of eval / execute

davestewart

New Member
Joined
Feb 15, 2006
Messages
43
Hi All,
Sorry if this has been asked before - I've tried searching the forum with no luck.

Is there a VB(A) equivilant?

I'd like to be able to such things as:

theSub="mySub"
Eval(theSub)

and a whole host of other things you would take for granted in other languages.

Thanks,
Dave
 
Hi Dave

Interesting discussion you initiated here :-)

I am interested to know out of all the languages you have used, which one have you preferred to use the most?

My experience of programming is pretty much restricted to VBA and very (very) simple C - so an experienced outlook is always of interest and appreciated.

Thanks for your time!

Richard
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I don't know your background but to claim you can "simulate" what you want with arrays for "simple variables" leaves out a lot of capability in modern languages. You might want to look into user defined types, classes (and objects), and collections (and similar).

You may be surprised to learn that very few 3GL/4GLs support the concept of execution of dynamically created code -- with good reason. It makes a program very difficult to understand, debug, or maintain.
{snip}
I know I could use arrays to simulate this for simple variables, but a lot of times it's useful to do it this way.

Any ideas?

LISP does.
 
Upvote 0
Interesting discussion you initiated here :-)
Thanks!
I am interested to know out of all the languages you have used, which one have you preferred to use the most?
Crikey... big question. It completely depends on what you want to achieve I suppose.

MaxScript: Love it as it has a whole bunch of built in 3D functions, and the whole program is so open - you're working with real 3D objects and animation. You can create your own animation tools, manipulate mesh vertices, you name it. Also you can use ActiveX controls to build new and exciting interfaces, even integrate Macromedia Flash to create custom control panels...

PHP - Magic Quotes - just the most awesome things ever! Define a bunch of variables $name, $address, $color and print a string like so : print "$name lives at $address and his favourite color is $color"

Flash ActionScript 2 - Brilliant fun for just getting in there and making things move! Create some shapes, do some timeline animation, then add a bunch of interactivity - you can create some amazing stuff, games, applications, you name it! I'm quite into particles and autonomous objects (look for the fish on my site)

VBA - I must say I am loving automating Office!

JavaScript - **** this is just ubiquitous... DHTML, and now stuff like Scripting For After Effects, Photoshop, JSFL for Flash, etc. Last year I animated 3 hours of stuff for BBC (Beethoven Uncovered, BBC4) driven entirely from musical data (1st year I wrote it all in Excel, the next I wrote an app to log it) ... it was just great fun!

XML - Jeez, XML is my daily dose these days. It provides a geat method to get data into just about anything these days ... at the moment it's a Flash website for Sony.

My next thing is going to be C#. Got Visual Studio Express (free at the mo fro MS) and some kind of .NET Windows apps... once I've got all the other stuff out the way.

If you want to check out what I do... www [dot] pondskata [dot] com.

Crack on with some other languages my man - it really is the way forwards, opens up your mind and keeps you fresh.

TTFN...
 
Upvote 0
Hi Dave,

If you have time to type all of that out, you surely have time to glance at my links; relevant, light reading that's fairly brief. :wink: :-P
 
Upvote 0
Yo Nate,

I did read (aka "skim") it ... but had a hell of a week this week didn't have time to digest it properly, and didn't want to take the **** with some kind of half-assed reply. Have done so now, and get what you're on about (although the memory stuff is beyond my scope).

The short of it is that I've enough experience to know that hacks and work-arounds in the wider world can only mean headaches. If VB(6) doesn't support what I want, then that's absolutely fine - I'm not going to shoe horn it into anyone's lap (least of all people who will come back to ME a few weeks / months from now wanting fixes!).

The key thing? I write the code that somebody else put on this earth for me to write. If it doesn't work the way I want it to, I don't have the higher know-how to complain, so I'll just be grateful that I got what I got.

Cheers for now ;),
Dave
 
Upvote 0
Hi Dave,

Okay, well that was kind of the point, while there's no shame in using custom Classes, this definitely strikes me as hacking away at something that's not really native and not a commonly used technique. ;)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top