Here is a simmple question that had me working over and over for the last 2 days... I would like to edit custom properties of my parts and assemblies from excel. It sounds simple but I couldn't find the right way to do it.
Actually, I only need to edit the project number of parts and assemblies, so that I can retrieve it in the corresponding drawings. I already read quite a lot in this forum and all the examples I found were about editing the custom properties of the active doc. However, in my case my active doc is the main assembly. And I need to edit the properties of parts and assemblies within the main assembly. I also checked out the custom properties tab builder. It works good but I will have to manually select all the parts that I want to edit the project number. However, it is time consuming and I have library components assembled and I will have to sort them out of my selection.
Here is the code I have so far:
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.AssemblyDoc
Dim swComp As SldWorks.Component2
Set swApp = GetObject(, "SldWorks.Application")
Set Part = swApp.ActiveDoc 'Active doc is my main assembly
' This line works perfect. But only on the custom propeties of my main assembly (which is the active doc)
Part.CustomInfo("Project_No") = Worksheets("Base").Range("G69").Value
' I got an error message on ths line. I get the same error when selecting the component with a SelectByID method.
Set swComp = Part.GetComponentByName("Placa_BAS-1")
swComp.CustomInfo("Project_No") = Worksheets("Base").Range("G69").Value
Anybody could help please?