10 Replies Latest reply on Jun 18, 2018 8:48 AM by Deepak Gupta

    Have SW open files from path but also the subdirectories.

    Robert Voogt
      Sub main()
          Set swApp = Application.SldWorks
          Const Path As String = "C:\PDMWorks View\Sub samenstellingen\"
          sFileName = Dir(Path & "*.slddrw")
      Dim doc         As SldWorks.ModelDoc2
      Dim fileerror   As Long
      Dim filewarning As Long
      t = 0 'temporary
          Do Until sFileName = ""
          Set swApp = Application.SldWorks
          swApp.Visible = False
          Set doc = swApp.OpenDoc6(Path & sFileName, swDocDRAWING, 2, "", fileerror, filewarning)
          boolstatus = swApp.RunMacro2("D:\Spare Part Generator\Macro\MARS RDC.swp", "RDC", "main", swRunMacroDefault, False)
          sFileName = Dir
          t = t + 1 'temporary
          If t > 10 Then Exit Do 'temporary
      End Sub


      This code works fine, but how can I modify this to also look in every subdirectory of that path?