Macro to check for Custom Property Field
Macro to check for Custom Property Field
(OP)
Greetings all,
I am running SW2005 and have a need to check for the existence of a custom property field (non configuration specific) in a macro. I am currently running the following VB Routine to create a custom field called "Manufacturer".
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
retval = Part.AddCustomInfo3(ConfigName, "Manufacturer", 30, "AAA")
End Sub
Before creating the custom field, I would first like to check for the existence of that field, and simply leave it alone if it exists. This way, I will not overwrite a custom property value if it allready exists. If it does not exist, then I would like to create it and populate it as shown in the above code.
Is it possible to check for the existence of an existing custom property field? What would the code look like to do this? Thanks in advance for any advice!
I am running SW2005 and have a need to check for the existence of a custom property field (non configuration specific) in a macro. I am currently running the following VB Routine to create a custom field called "Manufacturer".
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
retval = Part.AddCustomInfo3(ConfigName, "Manufacturer", 30, "AAA")
End Sub
Before creating the custom field, I would first like to check for the existence of that field, and simply leave it alone if it exists. This way, I will not overwrite a custom property value if it allready exists. If it does not exist, then I would like to create it and populate it as shown in the above code.
Is it possible to check for the existence of an existing custom property field? What would the code look like to do this? Thanks in advance for any advice!
Mark Price
www.assembly-testww.com
Automated Assembly & Test Systems






RE: Macro to check for Custom Property Field
BTW - you code above will add the custom property at the configuration level. If you want to add it at the document level, you need to pass an empty string where you are currently passing ConfigName.
Evan T. Basalik, MCSD
--------------------------------
It's all about prioritization...