给你个例子参考:
代码如下:
Option Explicit
Private Sub Command1_Click()
Dim y As Double
Dim Scr As Object
Dim dss As String
dss = UCase(Text1.Text) '读取代数式
Set Scr = CreateObject("MSScriptControl.ScriptControl")
Scr.Language = "Vbscript"
y = Scr.Eval(dss)
Text2.Text = y
End Sub
Private Sub Command2_Click()
End
End Sub