4 Replies Latest reply on May 19, 2015 8:42 AM by Jonny Levelius

    SaveAs new filename not SaveAs copy

    Jonny Levelius

      I was wondering how to make a macro call SaveAs and not save it as a new copy.  I am trying to just rename a file in my code and not make a copy.  What I have so far is a code that saves the file as one of the custom properties but it ends up saving a new copy.  Here is my macro.

      Set swApp = Application.SldWorks

      Set swModel = swApp.ActiveDoc

      Set swModelDocExt = swModel.Extension

       

      Set swCustProp = swModelDocExt.CustomPropertyManager("")

       

      swCustProp.Get2 "Part Number", val, valout

       

      PathName = swModel.GetPathName

       

      Filepath = Left(PathName, InStrRev(PathName, "\"))

      If (swModel.GetType = swDocASSEMBLY) Then

          swModel.SaveAs (Filepath & valout & ".sldasm")

          'swModel.SaveAs (Filepath + strPaste + ".sldasm")

      ElseIf (swModel.GetType = swDocPART) Then

           swModel.SaveAs (Filepath & valout & ".sldprt")