Archived

This topic is now archived and is closed to further replies.

Visual Basic Question

This topic is 5779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

two thoughts, "Like"
a = "this.txt" like "*.txt"
results in a being true

or using mid$, looping through the string, something like

searching = "testing.txt"
searchstring = "*.txt"
For a = 1 To (Len(searching) - Len(searchstring))
If Mid$(searching, a, Len(searchstring)) = searching Then
''Do something, a is the position
End If
Next a

Share this post


Link to post
Share on other sites
Don''t forget about Instr(string, search string). It will return the position of the search string in the string if it finds it or return 0.

if instr(blah, ".txt") <> 0 then
msgbox ".txt found!"
end if

Share this post


Link to post
Share on other sites