Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to execute the line
Message
De
30/08/2001 17:17:14
 
 
À
30/08/2001 16:38:28
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00551091
Message ID:
00551116
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform