I have a macro that I found here that I am trying to modify to create a Property with the Cutlist Folder Name as its value like the MK# shown here that I manually inserted:
I've modified the macro and it runs but unfortunately doesn't actually do anything. Any help would be appreciated and if you could point me to some resources to learn Solidworks specific VBA I would love that as well. Thank you in advance!
Here is the macro:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim MemberMKnumber As String
Dim BodyFolder As SldWorks.BodyFolder
Dim doc As SldWorks.ModelDoc2: Set doc = swApp.ActiveDoc
On Error Resume Next
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
swCustPropMgr.Get4 "Mark No. Part", False, MemberMKnumber, ""
Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing
If swFeat.GetTypeName() = "CutListFolder" Then
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "MK#", swCustomInfoText, "SW-CutListItemName@@@" + BodyFolder + "@" + doc.GetTitle + ".SLDPRT"
Set swFeat = swFeat.GetNextFeature