title: Loop through files to retrieve data for solidworks
body: <p>I have written the following code which works fine when I open one file. However, my knowledge of vba coding is low. I used a for loop in order to open a range of file names output_1 to output_61, but I get the error of "Run-time error '53' File not found". Can anyone help me with this?</p>
  
  <p>Here is the code I have wrote:
  Regards,
  Jer</p>
  
  <pre><code>Dim swApp As Object
  
  Sub main()
  
      Set swApp = Application.SldWorks
      Set Part = swApp.ActiveDoc
      swApp.ActiveDoc.ActiveView.FrameState = 1
      Dim skPoint As Object
  
      For i = 1 To 61
          Open "C:\Users\jerry.obrien\Desktop\2MW Blade\Solidworks\output_i.txt" For Input As #1
          Part.SketchManager.Insert3DSketch True
          Do While Not EOF(1)
              Input #1, X, Y, Z
              Set skPoint = Part.SketchManager.CreatePoint(X / 1, Y / 1, Z / 1)
          Loop
      Next i
      Close #1
  
      Part.ShowNamedView2 "*Isometric", 7
      Part.ViewZoomtofit2
  End Sub
  </code></pre>