A
A
Ai Lab2015-12-24 17:48:51
Programming
Ai Lab, 2015-12-24 17:48:51

Why is VBA not looking for a substring?

There is a primitive script that loads an array with words and searches for each of the words in the substring s, but the catch is that InStr always returns 0, regardless of whether there is a substring in s or not. The question is why might this be?

Dim A As Variant
Const strFileNameA = "C:\Users\vpuhoff\Desktop\CatA\CatA\bin\Debug\asdA.inf
Open strFileNameA For Input As #1
A = Split(Input$(LOF(1), #1), vbLf)
Close #1
 Dim s2 As String
    s2 = Trim(A(i))
    If (InStr(1, s, s2) > 0) Then

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ai Lab, 2016-01-09
@vpuhoff

As it turned out, the problem was in the invisible line break characters, after removing them from the search string for the search, everything started working fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question