AnsweredAssumed Answered

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

Question asked by Niels Raahauge on Sep 13, 2018
Latest reply on Sep 13, 2018 by Josh Brady

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

Outcomes