i am trying to search for a string in a string, my problem is the string i am searching for i only know the first few characters and the last few, the middle characters will change, is this possible.
Printable View
i am trying to search for a string in a string, my problem is the string i am searching for i only know the first few characters and the last few, the middle characters will change, is this possible.
i'am not sure whether u can do that way
u can do this way u type the first few characters and get the rest typed in try the below code
form
MakeAutoComplete (Text1)
'code
Private Declare Function SHAutoComplete _
Lib "Shlwapi.dll" _
(ByVal hwndEdit As Long, _
ByVal dwFlags As Long) As Long
Private Const SHACF_DEFAULT As Long = &H0
ok this possible code i am going to use, and will eventually replace the string i am searching for with a different one that has been changed but depends on those middle characters from the findstring that i do not know and will change. what i need to know is if i can define the findstring in a way that this will work without knowing the middle 1-4 characters of the findstring.
' Get the first occurrence of the string
StringPos = InStr(0, searchstring, findstring, vbTextCompare)
If StringPos = 0 Then etc...
Else
' Get the length of the string to find
StringLen = Len(FindString)
' Set the starting position of the selection
searchstring.SelStart = StringPos
' Set the selection length
searchstring.SelLength = StringLength
End If