I am trying to upload/modify several custom property fields within Assemblies, Parts, Weldment, and Multibody parts. When is comes to VBA I know very little, but I do have the ability to take something that is already working great and ruin it in VBA. In all seriousness, if it was created by someone else and it is simple, I can usually follow the logic and modify it to work for me. I found a (API?) on the forum and it works well at pulling out the information from single parts or assemblies. It is looking into the custom properties "ActiveCell.Value = Model.GetCustomInfoValue("", AttrNimiSolu)" and extracting the data, and it will also import it back in and rewrite it. It was originally written by Markku Lehtola. There are more than a few things I don't understand about it, but I know it can't return data from the Weldment Properties if it is looking at just the properties text document. Its also has an active table range of A-Z and I need it to go from A-CJ (That includes all my custom properties). What I would like it to do is run it as designed, but add a 3rd worksheet to run Multibody parts, with only the properties from the Weldment Properties text doc. I've tried every which way I can to modify the code with no positive results. I didn't know if adding the properties from the Weldments to the custom properties list would do anything? What I really could use is a little help from you gentlemen who know VBA. I have attached both the (API?) and a sample of the kind of part I need to import and export data from. I have also tied to export the data using #Task, and it returns a result of "True" down all the Excel columns, but it has been an awesome tool. Thanking you in advance.
Ken

Weldment custom properties are different than document custom properties (but you already knew that). I looked over the macros in your workbook. Must be an old macro you copied; the calls used have been obsolete for about 10 years (however they still work). Since you like to tinker on your own. Look up "Get Solid Bodies from Cut-list Folders and Get Custom Properties Example" in API help for retrieving weldment custom properties.
In the meantime, I am not familiar with the calls used to set the cell range from A - Z, so I will need to do some time to dissect it (although this close to the holidays does not give me a lot of time)...
Solid Air,
I've been doing it manually up till now, so I'll be fine until you have time to look at. I appreciate that fact that you reviewed it. I had to spend an hour with Google Translate just to even pretend I knew his methodology. In the 2014 or 2015 Solidworks API help section I was able to find code to extract the custom properties from a weldment. It could have been written in Greek, and it wouldn't have affected my understanding of it. I'm a big believer in not reinventing the wheel, but it is way over my head. I'll attach it and maybe it can help you in your review. The code on top is the translated version from the Excel file, and the code below the dashed line is the code I found in the API Help section.
Thank You,
Ken
FYI, I download the excel file with the code in it. You just open up Solidworks without opening the file, and it opens the file, exchanges the custom property data, and then closes the file.
By looking at your text file, it looks to me you have figured out how to get the code to go out to column CJ. I could not get the code to run properly because your example file did not have any properties in them.
The code you included for getting the cut list properties does not look right to me. I did not think the cut list folder is a sub feature. I quickly wrote some code for use as a SolidWorks macro; it should give you a guide (hopefully) for what you need to do in Excel.
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Sub GetCLProp(swCLFeat As SldWorks.Feature)
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim vCustPropNames As Variant
Dim vCustPropName As Variant
Dim ValOut As String
Dim ResValOut As String
Dim WasRes As Boolean
Set swCustPropMgr = swCLFeat.CustomPropertyManager
vCustPropNames = swCustPropMgr.GetNames
For Each vCustPropName In vCustPropNames
swCustPropMgr.Get5 vCustPropName, False, ValOut, ResValOut, WasRes
Debug.Print , vCustPropName, ResValOut
Next
End Sub
Sub main()
Dim swFeat As SldWorks.Feature
Dim swSubFeat As SldWorks.Feature
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swFeat = swDoc.FirstFeature
Do Until swFeat Is Nothing
Set swFeat = swFeat.GetNextFeature
If swFeat.GetTypeName2 = "EqnFolder" Then Exit Do
Debug.Print swFeat.Name, swFeat.GetTypeName2
If swFeat.GetTypeName2 = "CutListFolder" Then GetCLProp swFeat
Set swFeat = swFeat.GetNextFeature
Loop
End Sub
Solid Air,
Sorry about the delayed response. I had to go down to nowhere Mexico the day after Christmas to handle some systems issues, and just got back in last night. The top code is simply the code from the Excel file, with the Finnish translated into English so I could understand his steps. The code isn't run in solidworks. You open the excel file and you start Solidworks but you don't open any files. You enter the path in the excel file and then in D3 you enter the total amount of custom properties you have in a part or assembly (depending on which tab you're on). Then hit the Read Data button and it will extract the custom property data from the file by opening the file in Solidworks, saving the file, and then closing the file. The number of custom properties must include the number of auto-populated from Solidworks. So there are no individual properties in the code. The file I attached is a multibody weldment and the Excel API doesn't work on those. If you need a file with custom properties I can post another. As far as the second code, it was an API example written by Solidworks on extracting custom properties from weldments and multibody parts. I couldn't tell you if it's a recipe for KFC coleslaw or plans to build a robot. It just simply over my head.
Ken
Please look at the code I supplied to see you it works for you (or maybe it is a Mars Burger recipe).
That made my day
Dave.