3 回答
TA貢獻1802條經驗 獲得超5個贊
您也可以使用特殊詞like:
Public Sub Search()
If "My Big String with, in the middle" Like "*,*" Then
Debug.Print ("Found ','")
End If
End Sub
TA貢獻1784條經驗 獲得超7個贊
您還可以編寫一個函數,如果存在子字符串,則返回TRUE,否則返回FALSE:
Public Function Contains(strBaseString As String, strSearchTerm As String) As Boolean
'Purpose: Returns TRUE if one string exists within another
On Error GoTo ErrorMessage
? ? Contains = InStr(strBaseString, strSearchTerm)
Exit Function
ErrorMessage:
MsgBox "The database has generated an error. Please contact the database administrator, quoting the following error message: '" & Err.Description & "'", vbCritical, "Database Error"
End
End Function
添加回答
舉報
