I'm trying to get a specific custom property of a selected part. I found this discussion that claims to provide the answer, but when I try to use that in my code, I get errors: .
Here's the code I'm currently using:
Sub OpenSource()
Dim lSuccess As Long, swModel As ModelDoc2, SourceURL As String
Dim selMgr As SelectionMgr, Path As String
With Application.SldWorks.ActiveDoc
With .SelectionManager
If .GetSelectedObjectCount2(-1) <> 0 And _
.GetSelectedObjectType3(1, -1) <> 0 Then
SourceURL = .GetSelectedObjectsComponent4(1, -1).GetModelDoc2.Extension.CustomPropertyManager("").Get("Source URL")
End If
End With
End With
End Sub
This produces the following error on line 10:
Also, it would be very beneficial to know if the properties of a part set to lightweight are visible to the API.
Any help anyone can provide would be greatly appreciated. I'm using SolidWork Professional 2015 on a Windows 7 machine.
SolidworksApi macros