代码如下
Function bTest(ByVal s As String, ByVal p As String) As Boolean
    Dim re As RegExp
    Set re = New RegExp
    re.IgnoreCase = False  '?置是否匹配大小写
    re.Pattern = p
    bTest = re.test(s)
End Function
Option Explicit
Private Function test()
    Dim i As Integer
    Dim j As Integer
    Dim oldpos As String
    Dim xinpos As String
    Dim k As Integer
    s = Trim(ActiveWorkbook.Sheets("sss").Cells(2, 3))    '字符串中是否包含=:
    p = "="
    MsgBox bTest(s, p)
    
End Function这是报错信息,大意是类型没有被定义吧懂的人解释下

解决方案 »

  1.   

    引用 Microsoft VBScript Regular Expressions
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 
    http://feiyun0112.cnblogs.com/
      

  2.   

       Dim re As RegExp 
        Set re = New RegExp 

    dim re as object    
    Set Re = CreateObject("VBSCRIPT.REGEXP")    'Re为建立正则表达式
        Re.Global = True    '设置全局可用