title: Loop through workbook and sheets in each workbook vba
body: <p>I want to loop through all Workbooks in a folder and then loop through all worksheets of each workbook. I have the code below but currently the problem is with the line <code>For Each ws in StrFile.Sheets</code>:</p>
  
  <pre><code>Sub LoopThroughFiles()
      Dim StrFile As String
      StrFile = Dir("C:\Users\A9900899\Desktop\bob\VBAProject\Raw\")
      Do While Len(StrFile) &gt; 0
          Debug.Print StrFile
          For Each ws In StrFile.Sheets
              Debug.Print ws.Name
          Next ws
          StrFile = Dir
      Loop
  End Sub
  </code></pre>
  
  <p>What is my mistake here? </p>