• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Executing a String from an Array

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
IsleOfView
Asked:
IsleOfView
1 Solution
 
SPECIALISTCommented:
It depends on what you want to do.  Give a specific example of what you want to do.  


Specialist

0
 
IsleOfViewAuthor Commented:
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
 
FoyalCommented:
Sub AMessage(Index as Integer)
    Msgbox Array(Index)
End Sub
0
 
IsleOfViewAuthor Commented:
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
 
mark2150Commented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now