title: Runtime error '52' Bad filename or number with Dir$ function
body: <p>I need to check if a chrome.exe file exists, and if so, open the browser. I'm getting </p>
  
  <blockquote>
    <p>Runtime error '52' Bad filename or number</p>
  </blockquote>
  
  <p>On the first <code>If</code> check. Why is that?</p>
  
  <pre><code>Sub openChrome()
      Dim chromePath32
      Dim chromePath64
      Dim chromePathUser
      Dim current_user
  
      chromePath32 = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""
      chromePath64 = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
      current_user = (Environ$("Username"))
      chromePathUser = """c:\users\" &amp; current_user &amp; "\AppData\Local\Google\Chrome\Application\Chrome.exe"""
  
      If Dir$(chromePath32) &lt;&gt; "" Then '&lt;-----error here
          Shell (chromePath32 &amp; " -url http:google.co.nz")
      ElseIf Dir$(chromePath64) &lt;&gt; "" Then
          Shell (chromePath64 &amp; " -url http:google.co.nz")
      ElseIf Dir$(chromePathUser) &lt;&gt; "" Then
          Shell (chromePathUser &amp; " -url http:google.co.nz")
      Else
          MsgBox "Chrome installation not found"
          Exit Sub
      End If
  End Sub
  </code></pre>