By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,704 Members | 1,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,704 IT Pros & Developers. It's quick & easy.

Execute a command read from a file?

P: n/a
Hi All,

I would like to read commands from a file and execute them in VB, something
like reading str = "hello world" into VB and execute it. Any suggestions
will be appreciated.

Thanks,
Lance
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Lance" <Lb******@yahoo.com> wrote in message
news:D6*********************@newsc.telia.net...
Hi All,

I would like to read commands from a file and execute them in VB, something like reading str = "hello world" into VB and execute it. Any suggestions
will be appreciated.

Thanks,
Lance


Not doable if you want to execute it as you read the file.

If you want to read the entire file, then yes, you can just write a compiler
emulator (create variable lists, jump tables, etc.)
Jul 17 '05 #2

P: n/a
Like most answers, it depends. I have a program that acts like a server and
receives commands from a client over the net. The server application then
executes the commands it receives. My application drives external equipment
for a whole house audio system.

So it depends. What are the commands you are trying to execute?

"Lance" <Lb******@yahoo.com> wrote in message
news:D6*********************@newsc.telia.net...
Hi All,

I would like to read commands from a file and execute them in VB, something like reading str = "hello world" into VB and execute it. Any suggestions
will be appreciated.

Thanks,
Lance

Jul 17 '05 #3

P: n/a

"Lance" <Lb******@yahoo.com> wrote in message
news:D6*********************@newsc.telia.net...
Hi All,

I would like to read commands from a file and execute them in VB, something
like reading str = "hello world" into VB and execute it. Any suggestions
will be appreciated.

Thanks,
Lance


Try out the often overlooked Microsoft Script Control 1.0, available in your
list of components to add to a project. With a script control called SC1 on a
form, you can do things like this:

Private Sub Command1_Click()
Dim strCode As String

strCode = "Sub HelloSub()" & vbNewLine
strCode = strCode & "strHello = ""Hello World""" & vbNewLine
strCode = strCode & "Msgbox strHello" & vbNewLine
strCode = strCode & "End Sub" & vbNewLine

Debug.Print strCode

SC1.AddCode strCode
SC1.Run "HelloSub"

End Sub


Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.