比如在“張三家里有條狗名字叫小花”字符串中判斷是否有“名字”存在?
Sub test1() Dim str As String str = "張三家里有條狗名字叫小花" If InStr(str, "名字") Then MsgBox "包含" Else MsgBox "不包含" End If End Sub Sub test2() Dim str As String str = "張三家里有條狗名字叫小花" If str Like "*名字*" Then MsgBox "包含" Else MsgBox "不包含" End If End Sub