AnsweredAssumed Answered

Have SW open files from path but also the subdirectories.

Question asked by Robert Voogt on Jun 18, 2018
Latest reply on Jun 18, 2018 by Deepak Gupta
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

    
    
    Loop
    
  
End Sub

 

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

Outcomes