My company has titleblocks that reference a property on the model with the sheet property name \$PRPSHEET:"Commodity Code" that I would like to access with a macro from the active drawing.
I've been googling around. The closest I have come in the sample code in...
which I've altered to...
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim swModelDocExt As ModelDocExtension
Dim swCustProp As CustomPropertyManager
Dim val As String
Dim valout As String
Dim bool As Boolean
Dim sPropName As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
sPropName = "Commodity Code"
' Get the custom property data
Set swCustProp = swModelDocExt.CustomPropertyManager("")
bool = swCustProp.Get4(sPropName, False, val, valout)
Debug.Print sPropName & " - Value: " & val
Debug.Print sPropName & " - Evaluated value: " & valout
Debug.Print sPropName & " - Up-to-date data: " & bool
End Sub
But it doesn't work. This code only seems able to see properties made using the "PRP:??????".
Can anyone point me in the right direction?
Thanks