AnsweredAssumed Answered

Save as Configuration Macro

Question asked by Daniel Fielder on Mar 3, 2017
Latest reply on Mar 6, 2017 by Deepak Gupta

Hi,

 

I am trying to save my part using a Tool Number in "Summary Information, Configuration Specific" but I cant get this Macro to work, it only saves as "TN".

 

Sub main()

Dim swApp As SldWorks.SldWorks

Dim SWmoddoc As SldWorks.ModelDoc2

Dim partnumber As String

Set swApp = Application.SldWorks

Set SWmoddoc = swApp.ActiveDoc

partnumber = SWmoddoc.CustomInfo("ToolNumber")

If (SWmoddoc.GetType = swDocPART) Then

    SWmoddoc.SaveAs ("TN" + partnumber + ".sldprt")
  

ElseIf (SWmoddoc.GetType = swDocASSEMBLY) Then

     SWmoddoc.SaveAs ("TN" + partnumber + ".sldasm")
    
ElseIf (SWmoddoc.GetType = swDocDRAWING) Then

     SWmoddoc.SaveAs ("TN" + partnumber + ".slddrw")

End If

End Sub

 

Please Help!!!!

Outcomes