3 Replies Latest reply on Sep 13, 2018 11:16 AM by Josh Brady

    API open swd from Path - Contain explode?-Result to Excel-Next file

    Niels Raahauge

      SW2016SP4

       

      I have a lot of swd i need to investigate - is drawing containing a exploded view.

      I want to place all drawings in a folder - run a macro - and see the result in excel.

       

      The code does not open the swd in sw - I can't figure out why.

       

      I hope somebody can help me with this

       

      The code are attached as a file..

       

      As basic i use the same symtax as :

       

      Dim swApp As SldWorks.SldWorks

      Dim swDoc As ModelDoc2

      Dim fileerror As Long

      Dim filewarning As Long

       

      Const folder As String = "C:\TempCheckFiles\"

      Dim files As Variant 

      Sub main()

          Set swApp = Application.SldWorks

          files = Dir(folder & "*.sldprt", vbNormal)

          Do While files <> ""

              swApp.OpenDoc6 folder & files, swDocPART, 0, "", fileerror, filewarning

              files = Dir

          Loop

      End Sub