|
-
Oct 28th, 2000, 04:20 PM
#1
Thread Starter
New Member
Is thier a way to get some Visual Basic code from a text file and 'play' it?
CyberWil
P.S. If so, can someone make me a VB project file?
-
Oct 28th, 2000, 04:22 PM
#2
like what?
Example help make the world go 'round.
-
Oct 28th, 2000, 04:28 PM
#3
Thread Starter
New Member
Re: code from text file
Like:
This in text file:
Msgbox "Test"
End
Then i say in VB:
Open "test.txt" for input as #1
Play Code Here
Close #1
CyberWil
-
Oct 28th, 2000, 07:37 PM
#4
I understand what you mean. What you mean is that you put:
Msgbox "Hello"
in a text file. And you want to load it and have VB say:
Msgbox "Hello"
from the file. I don't think this can be done though.
-
Oct 28th, 2000, 09:38 PM
#5
You can use the script control to do this, but you need to add the procedures and modules properly. MSDN has reasonable resources on this.
Basically, the code would look like this:
Code:
Dim lobjScript As ScriptControl
Dim lstrParams As String
'Init the scripting object
Set lobjScript = New ScriptControl
'Setup the language
lobjScript.Language = "VBScript"
lobjScript.Reset
lobjScript.AddCode "Your code goes here"
lobjScript.Modules.Add "TestSub" 'so yo can reference it later
'Execute the code
lobjScript.Run "TestSub"
On the lobjScript.Run line, you can ad the parameters.
Hope that helps (don't forget to add a reference to the MS Script Control 1.0)
- gaffa
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
|