Is InStr or my Wildcard Causing Problems?
<p>I don't know why this doesn't work. It's part of a much larger subroutine, but I have narrowed the issue down to this use of a wildcard with the InStr function.</p>

<p>I have tried to find as much info on InStr and wildcards as I can, and as far as I can find this <em>should</em> work. But it doesn't. </p>

<pre><code>    Dim String1 As String
    Dim String2 As String
    Dim TestString As String
    Dim Location As Integer

    String1 = "Hello"
    String2 = "Goodbye"
    TestString = "Hello and Goodbye"
    Location = InStr(1, TestString, (String1 &amp; "*" &amp; String2), vbTextCompare)
    If Location &gt;= 1 then
        'Do Something
    End If
</code></pre>

<p>OK, I've tried some things based on what people have suggested, and now I'm at the point of this...</p>

<pre><code>    Dim SourceString As String
    Dim TestString As String
    Dim TempArray() As String

    SourceString = "Hello and Goodbye"
    TestString = "hello * goodbye"

    TempArray = Split(TestString, "*")
    If SourceString Like _
          Chr(42) &amp; TempArray(0) &amp; Chr(42) &amp; TempArray(1) &amp; Chr(42) Then
       Found = True
    End If
</code></pre>

<p>I've done debug.print of each section of the TempArray and it includes the spaces, so I know it's splitting right.</p>

<p>What am I missing now? :(</p>