Dim strScript As String Dim m As Long Dim n As Long Dim s As Long m = 1 n = 5 strScript = "dim m,n,s" & vbCrLf strScript = strScript & "m = " & m & vbCrLf strScript = strScript & "n = " & n & vbCrLf strScript = strScript & "s = m - n" & vbCrLf
ScriptControl1.Reset ScriptControl1.ExecuteStatement strScript s = ScriptControl1.CodeObject.s MsgBox s
If s Then MsgBox s
Dim strScript As String
Dim m As Long
Dim n As Long
Dim s As Long
m = 1
n = 5
strScript = "dim m,n,s" & vbCrLf
strScript = strScript & "m = " & m & vbCrLf
strScript = strScript & "n = " & n & vbCrLf
strScript = strScript & "s = m - n" & vbCrLf
ScriptControl1.Reset
ScriptControl1.ExecuteStatement strScript
s = ScriptControl1.CodeObject.s
MsgBox s