AnsweredAssumed Answered

Drawing Custom Properties Find & Replace

Question asked by Ashley Turk on Aug 2, 2016
Latest reply on Aug 3, 2016 by Towab Muhammad Yusuf



I'm new to using macro's / API in solidworks and I've not done any coding for many years.


We have about 600 drawings which have an incorrect digit within the FileName & CustomProperties.  We're tried modifying some code which we found on this forum (  But it seems to have rebuild even before we started chaning it on "Set swModelDocExt = swModel.Extension", is this becuase we're trying to use swModel on a slddrw? Or because things have changed on soldiworks in the last 4 years?


We are using Premium 2015 SP5


Custom Properties

We're trying to create a macro to find (“-1-“) and replace
(“-X-“) within the customer properties (GE_DrawingNumber & GE_Parent) of a
drawing set.


Before Macro

     GE_DrawingNumber = “-1-01-017”

     GE_Parent = “-1-01-005”

After Marco

     GE_DrawingNumber = “-X-01-017”

     GE_Parent = “-X-01-005”


The 017 & 005 will change from drawing to drawing.


I've attached my attemp at moifying the above code but I am struggling as I can't run the base code.  Do I need to install anything extra to run macros / API


Files Name


We need to update all the drawings to find (“-1-“) and
replace (“-X-“) within the file name of our drawing set, then save as the new

Before Macro

     Files Name = “SSP41848-1-01-017”

After Macro

     Files Name = “SSP41848-X-01-017”


The 017 will change from drawing to drawing.


We're currently not looked into this one.


Any assistance you could offer would be greatly appreciated.