Function InStr2(sSearchText As String, sForText As String, Optional ByVal lStart As Long = 1, Optional bCompareText As Boolean = False) As Long Dim lWildCardStartPos As Long, lWildCardPos As Long, lWildCardEndPos As Long Dim sSubtext As String, lCompare As Long 'Set variables lWildCardStartPos = lStart If bCompareText Then lCompare = vbTextCompare Else lCompare = vbBinaryCompare End If Do 'Search for wildcard lWildCardPos = InStr(lWildCardPos + 1, sForText, "*") If lWildCardPos Then lWildCardEndPos = lWildCardPos - 1 Else lWildCardEndPos = Len(sForText) End If 'Search input text sSubtext = Mid$(sForText, lWildCardStartPos, lWildCardEndPos - lWildCardStartPos + 1) lStart = InStr(lStart, sSearchText, sSubtext, lCompare) 'Check exit conditions If lStart = 0 Then 'Clear value and exit do Instr2 = 0 Exit Do ElseIf Instr2 = 0 Then 'Store value Instr2 = lStart End If If lWildCardPos = 0 Then Exit Do End If lWildCardStartPos = lWildCardPos + 1 Loop End Function
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE