Add Custom Property Example (VBA)
This example shows how to add a custom property to a drawing document.
' ----------------------------------------------
' Preconditions: Drawing document is open.
'
' Postconditions: The custom property Input1 is added
to the file.
'
' NOTE: Because configurations are not supported
' in
drawings, pass a blank string when the file is a drawing.
'------------------------------------------------
Sub main()
Dim swApp As
SldWorks.SldWorks
Dim swModel As
SldWorks.ModelDoc2
Dim swDraw As
SldWorks.DrawingDoc
Dim retval As
String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
retval = swModel.AddCustomInfo3("",
"Input1", swCustomInfoNumber, "2345")
MsgBox retval
End Sub
' ----------------------------------------------