Click to See Complete Forum and Search --> : Loading Vb commands from text file


Charles Pick
October 22nd, 1999, 08:22 AM
I want to call vb commands such as msgbox and inputbox from an ordinary text file. Is this possible and what is the syntax for running these commands when they have been put into a string.

Lothar Haensler
October 22nd, 1999, 08:43 AM
this is a sample for an interpreter:

add the Microsoft Script Control to the Components of your app

name it "s" (for lazy typers)

add a button
add the following code

private Sub Command1_Click()
Dim hFile as Integer
hFile = FreeFile
Dim strLine as string
Open "c:\test.txt" for input as #hFile
Do While Not EOF(hFile)
Line input #hFile, strLine
s.ExecuteStatement strLine
Loop
Close (hFile)
End Sub




this is my sample test.txt

msgbox "hello.world"
msgbox "greetings from the script control"

tested in NT 4 and VB 6