Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to execute the line
Message
From
30/08/2001 17:17:14
 
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00551091
Message ID:
00551116
Views:
20
>If I have a variable that can be executed.
>F.ex toexe="a=5"
>How do I actually execute it? Please!!!

You can use the script control for that. Although it doesn't seem to work with variable assignments as in your example. Something like this works fine:
Dim oSC As ScriptControl
Dim iVal As Integer
Set oSC = New ScriptControl
oSC.Language = "VBScript"

Dim toexe As String
toexe = "4*5"
iVal = oSC.Eval(toexe)

MsgBox iVal, vbOKOnly, "Value of iVal"
The script control also has an ExecuteStatement method.
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform