|
-
October 22nd, 1999, 08:22 AM
#1
Loading Vb commands from text file
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.
-
October 22nd, 1999, 08:43 AM
#2
Re: Loading Vb commands from text file
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|