If you're using SolidWorks 2014 then you can simply use ICustomPropertyManager::Add3 which, in the last argument, gives these options:
Hence you can choose to add the property only if it doesn't exist, in which case if it already existed, those original values will be kept. Or you can choose to delete and add, which means that post-running the property will have whatever new value you desired. You might play around with them and see what works best for you.
Const PROP_NAME_1 As String = "Published As" Const PROP_NAME_2 As String = "Revision" Const PROP_VAL_1 As String = Empty Const PROP_VAL_2 As String = Empty Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swCustPropMgr As SldWorks.CustomPropertyManager Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swCustPropMgr = swModel.Extension.CustomPropertyManager(Empty) swCustPropMgr.Add3 PROP_NAME_1, swCustomInfoText, PROP_VAL_1, swCustomPropertyOnlyIfNew swCustPropMgr.Add3 PROP_NAME_2, swCustomInfoText, PROP_VAL_2, swCustomPropertyOnlyIfNew End Sub
You can mimic all of this in 2013 and earlier you just need to use ICustomPropertyManager::GetX, AddX, and/or SetX in the right order depending on what you want.
Thanks a ton Keith,
I tossed this into the beginning portion of my macro and it worked like a charm!