title: Find an email with subject starting with specific text
body: <p>I am trying to find an email, by subject starting with specific text, to then download an attachment from that email. </p>
  
  <p>I am using a variable with Restrict function, however issue seems to be because of usage of wildcards.</p>
  
  <pre><code>Sub findemail()
  
  cntofmkts = Range("A" &amp; Rows.Count).End(xlUp).Row
  cntofmkts = cntofmkts - 1
  ftodaydate = Format(Date, "yyyy-mm-dd")
  
  Do
      If i &gt; cntofmkts Then Exit Do
  
      MarketName = Range("A" &amp; j).Value    
      Findvariable = "XXX_" &amp; MarketName &amp; "_ABC_" &amp; ftodaydate
  
      For Each oOlItm In oOlInb.Items.Restrict("[Subject] = *Findvariable*")
          eSender = oOlItm.SenderEmailAddress
          dtRecvd = oOlItm.ReceivedTime
          dtSent = oOlItm.CreationTime
          sSubj = oOlItm.Subject
          sMsg = oOlItm.Body
  
          If oOlItm.Attachments.Count &lt;&gt; 0 Then
              For Each oOlAtch In oOlItm.Attachments
                  '~~&gt; Download the attachment
                  oOlAtch.SaveAsFile NewFileName &amp; oOlAtch.Filename
                  Exit For
              Next
          Else
              MsgBox "The First item doesn't have an attachment"
          End If
  
          Exit For
      Next
  
      i = i + 1
      j = j + 1
  
  Loop
  End sub
  </code></pre>