Solved

Executing a String from an Array

Posted on 1998-08-18
5
137 Views
Last Modified: 2010-05-18
I have a series of strings in an array.  These strings are actually VB commands that I want to execute.  How can I tell VB to execute a certain index from an array?
0
Comment
Question by:IsleOfView
5 Comments
 
LVL 3

Expert Comment

by:SPECIALIST
Comment Utility
It depends on what you want to do.  Give a specific example of what you want to do.  


Specialist

0
 

Author Comment

by:IsleOfView
Comment Utility
Well, let's go from just the simplest example.
let's say that:

Array(0) = MsgBox "Hello World!"
Array(1) = MsgBox "Hello Again!"

Whatever--I would like to have these strings act as if they were a part of the module I am working in.  They should be able to call functions from other modules as well.

TIA
0
 
LVL 3

Expert Comment

by:Foyal
Comment Utility
Sub AMessage(Index as Integer)
    Msgbox Array(Index)
End Sub
0
 

Author Comment

by:IsleOfView
Comment Utility
Perhaps I'm not being clear--I don't know for sure that the array is going to contain, say, a msgbox command.  It might be something changing a property...The idea is to use the string contained in the array as a VB statement.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
Comment Utility
Umm, this idea can't work. VB is *COMPILED*, there is no way to dynamically interprit code at runtime. Your only option would be a *HUGE* task to write a VB emulator. There is just no concept of interpritted code in a compiled program.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now