2 Replies Latest reply on Sep 11, 2013 9:28 PM by Vincent Li

    Macro to New-Save-Close a part, but still got a temp part doc in SWX without being closed?why

    Vincent Li

      Dear Masters,

      I record a macro with these steps  :


      1.new a part with a part template.
      2.save the file without doing any thing, just save the empty part doc to somewhere.
      3.close the part doc.


      then the macro is as below, and I edited it a little bit that I need it to save the part named "ABC.sldprt"

      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.NewDocument("G:\Program Files\SolidWorks Corp\SolidWorks\lang\chinese-simplified\Tutorial\part.prtdot", 0, 0, 0)

      Set Part = swApp.ActiveDoc

      longstatus = Part.SaveAs3("E:\ABC.SLDPRT", 0, 2)
      Set Part = Nothing
      swApp.CloseDoc "ABC"
      End Sub


      when I run the macro, it do the thing I wanted , but leaving one thing that I do not understand:

      after the New-->Save-->Close the ABC.sldprt, the SW still contian a temp part doc there, and it named partXX, like we new a

      part, and SWX gives a temp name for the doc before we save it.

      What I need is making this temp part doc disappear after running the macro.