AnsweredAssumed Answered

Find Replace Custom Property in all Configs

Question asked by Paul Crotty on Mar 16, 2017
Latest reply on Mar 21, 2017 by Paul Crotty

Hello All,


I am new to the macro/API world and have been trying my best to understand some of this stuff. This forum has been very helpful in the past but this is my first post.


I found this discussion Macro Find & Replace custom property and modified it to my needs and it does work for the custom properties but not for all of the configuration specific properties. Our configs can be name a range of different things but are usually our part number. But basically we just need to delete the first two characters of the "Number" Custom and Config Specific Properties. 


Any help would be greatly appreciated.


Thank you




Here is the current code


Option Explicit

Dim swApp           As SldWorks.SldWorks

Dim swModel         As SldWorks.ModelDoc2

Dim swCustPropMgr   As SldWorks.CustomPropertyManager

Dim Prop1 As String

Dim Prop2 As String

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")


'Replace P1 with the actual property name

Prop1 = swModel.CustomInfo("")

Prop1 = Left(Prop1, 2)


Prop2 = swModel.CustomInfo("Number")

Prop2 = Right(Prop2, 4)


swModel.CustomInfo("Number") = Prop1 & Prop2


End Sub