How do I extract an $PRPSHEET value from an open drawing in VBA?

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...

https://help.solidworks.com/2024/english/api/sldworksapi/Get_Custom_Properties_of_Referenced_Part_Example_VB.htm?verRedirect=1

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