vb编程如下:
'引用Microsoft VBScript Regular Expressions 5.5
Private Sub Command1_Click()
On Error GoTo ErrorHandler
Dim RE As New RegExp
' 查找匹配字符串时忽略大小写
RE.IgnoreCase = True
' 搜索整个字符串
RE.Global = True
'替换字符
Dim s As String
s = Text1.Text
RE.Pattern = "exp"
s = RE.Replace(s, "自然底数e")
RE.Pattern = "x"
s = RE.Replace(s, Text2.Text)
RE.Pattern = "自然底数e"
s = RE.Replace(s, "exp")
' MsgBox s
Dim VBExcel As Object
Set VBExcel = CreateObject("Excel.Application")
Text3.Text = VBExcel.Evaluate(s)
Set VBExcel = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
全部回答(1 )
vb编程如下:
'引用Microsoft VBScript Regular Expressions 5.5
Private Sub Command1_Click()
On Error GoTo ErrorHandler
Dim RE As New RegExp
' 查找匹配字符串时忽略大小写
RE.IgnoreCase = True
' 搜索整个字符串
RE.Global = True
'替换字符
Dim s As String
s = Text1.Text
RE.Pattern = "exp"
s = RE.Replace(s, "自然底数e")
RE.Pattern = "x"
s = RE.Replace(s, Text2.Text)
RE.Pattern = "自然底数e"
s = RE.Replace(s, "exp")
' MsgBox s
Dim VBExcel As Object
Set VBExcel = CreateObject("Excel.Application")
Text3.Text = VBExcel.Evaluate(s)
Set VBExcel = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
End
End Sub