title: Shell.namespace not accepting string variable, but accepting string itself
body: <p>I have a code, in which I want to loop through files in a folder, check their built-in or custom document properties (without opening them), and later open those, which are meant to be open.
  To do this, I'm using <code>Shell</code> and to set the folder I'm using <code>Shell.Namespace</code>.  </p>
  
  <p><strong>The problem</strong> is with the <code>Namespace</code>, I guess. When I use a <em>variable</em> <code>strSuborCesta</code> for the path  <em>it doesn't work</em>. When I print the variable <code>strSuborCesta</code> into immediate window and use the printed <em>string</em> inside the <code>Shell.Namespace("....")</code> <em>it does work</em>.  </p>
  
  <p>By <em>it doesn't work</em> I mean I get:  </p>
  
  <blockquote>
    <p>run-time error : 91 Object variable or With block not set  </p>
  </blockquote>
  
  <p>when I try to loop through the files in folder (which is not set in that case, so I understand why the error occurred, but don't understand why it's not accepting a string variable)</p>
  
  <p>The path is correct in both ways. But <strong>I need it to be a variable</strong>, not a hardcoded string.  </p>
  
  <p><strong>Where do I error?</strong>  </p>
  
  <p><strong>Is there any better way, to check document properties (like comments, title, author, etc.) without opening the Excel files?</strong></p>
  
  <p>Below is the section (currently just in testing phase) that is giving me a hard time.  </p>
  
  <p><code>str[name of variable]</code> variables are string data types. <code>sFile, oShell, oDir are as Variants</code></p>
  
  <pre><code> '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  'get a root path
  strPriecinokCesta = ThisWorkbook.Path 'path to this file
  strPriecinokCesta = Left(strPriecinokCesta, Len(strPriecinokCesta) - (Len(strPriecinokCesta) - InStrRev(strPriecinokCesta, "\"))) 'root path is one level above this file
  '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  'input files are in a subfolder
  strSuborCesta = strPriecinokCesta &amp; "Zdroje\"
  strSuborPripona = "Formular_BD_kotolna*.xls" 'name of a file with extension
  strSuborNazov = Dir(strSuborCesta &amp; strSuborPripona) 'actual file name
  '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  'get access to the file system
  Set oShell = CreateObject("Shell.Application")
  Set oDir = oShell.Namespace(strSuborCesta) '&lt;----this will produce an error. In contrast to using a hard coded string. Why?
  
  For Each sFile In oDir.Items '&lt;---- run time error 91 occurs on this line
      Debug.Print test &amp; " : " &amp; oDir.GetDetailsOf(sFile, 24) 'comments
  Next
  </code></pre>