How to edit the custom property of a configuration ?
I tried the following code,but failure. The code has not error happend.
Function Edit_Part_CP
On Error GoTo ErrMsg
Dim swDocMgr As SwDocumentMgr.SwDMApplication
Dim swDoc As SwDocumentMgr.SwDMDocument5
Dim classfac As SwDocumentMgr.SwDMClassFactory
Dim swcfg As SwDocumentMgr.SwDMConfiguration ' I tried SwDMConfiguration1~7,but failure.
Dim I As Integer
Set classfac = CreateObject("SwDocumentMgr.SwDMClassFactory")
Set swDocMgr = classfac.GetApplication("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") 'Specify your license key
Set swDoc = swDocMgr.GetDocument(Me.FilePath, swDmDocumentUnknown, True, swDmDocumentOpenErrorNone)
If Not swDoc Is Nothing Then
Set swcfg = swDoc.ConfigurationManager.GetConfigurationByName(Me.Version)
swcfg.SetCustomProperty "Name", "try" ' This line is noneffective.
swDoc.Save
swDoc.CloseDoc
End If
Set swDoc = Nothing
Set swDocMgr = Nothing
Set classfac = Nothing
Set swcfg = Nothing
Exit Function
ErrMsg:
MsgBox Me.FilePath & vbCrLf & Err.Description
End Function
SolidworksApi macros