title: Run-time error 9 in vba
body: <p>Good day, I'm pretty much new in VBA, and I have a problem with path specifying, consider the following:</p>
  
  <pre><code>x = Workbooks(ThisWorkbook.Path &amp; "/" &amp; "06-17.xlsx").Worksheets(1).Cells(2, 1).Value
  </code></pre>
  
  <p>With this piece of code I have run-time error 9, but if I use the following code it works fine:</p>
  
  <pre><code>Workbooks.Open (ThisWorkbook.Path &amp; "/" &amp; "06-17.xlsx")
  x = ActiveWorkbook.Worksheets(1).Cells(2, 1).Value
  </code></pre>
  
  <p>I have founded that run-time error 9 means that elements of arrays and members of collections can only be accessed within their defined ranges, but how it relates to my case, I have no idea. 
  Why it happens?</p>