title: Excel VBA File not Found although file exists
body: <p>I have written below piece of code to access a file and copy content from one file to the other. I am using excel 2007.</p>
  
  <pre><code>Sub copypaste()
  
    Dim strFolder As String
    Dim strFileName As String
    Dim wb As Workbook
    strFolder = "C:\Users\user\Desktop\sample\"
    strFileName = Dir(strFolder &amp; "*.xlsx")
    Dim eRow
    Dim a As Variant
    Dim b As Variant
    Do While Len(strFileName) &gt; 0
    **Set wb = Workbooks.Open(strFileName)**
    a = Cells(7, 7)
    b = Range("D11:F11")
    ActiveWorkbook.Close
        Worksheets("sheet1").Cells(7, 7) = a
        Worksheets("sheet1").Cells(7, 8) = b
        strFileName = Dir
    Loop
  End Sub
  </code></pre>
  
  <p>Although the file exists in the folder I get the error while opening the file. While in debug mode the variable strFileName contains the file name but still the file is not opening. I am getting the error at line <code>"Set wb = Workbooks.Open(strFileName)"</code></p>
  
  <p>Thanks in advance for your help!!</p>