Can anyone help me with this macro ?

In my parts I add 2 custom properties (Proyecto & Piezanum).
I need that when i do a drawing with this part and save this drawing,
the name of the drawing file must be "Proyecto-Piezanum.slddrw".
Is it possible?, How?
Thanks for your answers :)
Reply to
Loading thread data ...
First off, rely heavily on the API help from the SW help menu.
FileName = DwgDoc.CustomInfo2(configuration, fieldName1) & "-" _ & DwgDoc.CustomInfo2(configuration, fieldName2) retval = DwgDoc.SaveAs4 (FileName, Version, Options, &Errors, _ &Warnings)
Where: FileName = Name of drawing to save configuration = Name of part configuration (use View.ReferencedConfiguration to extract from your drawing view) fieldName1&2 = Name of property with values Proyecto & Piezanum See API help for other variables
You should declare all variables.
If you want to buy a SW utility from my site, I'll write it for you. They start at $10 but you can download and use it in a limited but still useful mode until registered.
formatting link

Kent KCS Company
formatting link

Reply to
KCS Company
Thank you Kent, But I'm not sure how to do it. Here is my code: ********************************************** Dim swApp As Object Dim CurrentDoc As Object Dim swModel As SldWorks.ModelDoc2
Sub main() Set swApp = Application.SldWorks Set CurrentDoc = swApp.ActiveDoc Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc
CurrentDoc.ViewZoomtofit2 ' zoom to fit CurrentDoc.EditRebuild ' rebuild doc
CurrentDoc.Save2 False ' "save doc"
swApp.QuitDoc swModel.GetTitle End Sub ********************************************** My idea is substitute "save doc" code with your code (saving the drawing file with "Proyecto-Piezanum.drw" file name. But I am not capable of doing it, can you help me?
Reply to

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.