I need some help modifying a macro I have found. The macro is to rename bodies of a weldment. It works great except for I am wanting it to pull a custom property (named "PART_NUMBER") from the weldment cutlist properties. I need the prefixName to pull my custom property "PART_NUMBER"
Dim swApp As Object
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swPart As SldWorks.PartDoc
Dim vBodyArr As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swPart = swModel
vBodyArr = swPart.GetBodies2(0, False)
RenameBodies swModel, vBodyArr
Sub RenameBodies(swModel As SldWorks.ModelDoc2, vBodyArr As Variant)
Dim vBody As Variant
Dim swBody As SldWorks.Body2
Dim prefixName As String
Dim bodycount As Integer
bodycount = 1
If IsEmpty(vBodyArr) Then Exit Sub
prefixName = "NEED THIS TO PULL FROM A CUSTOM WELDMENT PROPERTY (NAMED "PART_NUMBER")"
For Each vBody In vBodyArr
vBody.Name = prefixName & bodycount
bodycount = bodycount + 1
Any help would be greatly appreciated. I am hoping Deepak Gupta can help out as he seems to be the God of Soildworks macros.