Private Sub Command1_Click (): 85
Dim x
Dim y
Dim As Long S
X=10
Y=15
ScriptControl1. ExecuteStatement "x=" & amp; X
ScriptControl1. ExecuteStatement "y=" & amp; Y
S=ScriptControl1. Eval (" x + y + 60 ")
MsgBox S
End Sub
MsgBox show
Normal program execution
But to replace x with an array of x (1), to replace the y with an array of y (1), execute the following code:
Private Sub Command1_Click ()
Dim x As Long (1)
Dim y (1) As Long
Dim As Long S
(1)=10 x
Y (1)=15
ScriptControl1. ExecuteStatement "x (1)=" & amp; X (1)
ScriptControl1. ExecuteStatement "y (1)=" & amp; Y (1)
S=ScriptControl1. Eval (" x + y (1) (1) + 60 ")
MsgBox S
End Sub
System error: real-time error '13', type mismatch 'x'
Please give directions to a friend!
In this thank you very much!
CodePudding user response:
ScriptControl1. ExecuteStatement "Dim x (1) as Long"
ScriptControl1. ExecuteStatement "Dim y (1) as Long"
ScriptControl1. ExecuteStatement "x (1)=" & amp; X (1)
ScriptControl1. ExecuteStatement "y (1)=" & amp; Y (1)
S=ScriptControl1. Eval (" x + y (1) (1) + 60 ")
MsgBox S