9 Replies Latest reply on Apr 6, 2018 8:59 AM by Stanislao Bazoli

    Close part or assembly at the end of the macro

    Stanislao Bazoli

      Hi

      I have this macro and I can not close the document at the end of the macro. What am I missing?

       

      Dim swApp As Object

      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long

       

      Sub main()

       

      Set swApp = _

      Application.SldWorks

       

      Set Part = swApp.ActiveDoc

      boolstatus = Part.FeatureManager.EditFreeze(swMoveFreezeBarTo_e.swMoveFreezeBarToEnd, "", True)

         

      Part.SaveAs (Part.GetPathName)

       

      swapp.CloseDoc part.GetTitle()

         

      End Sub