I had this macro from this forum and modified to match your property
Sub Main() Dim swApp As SldWorks.SldWorks Dim swModel As ModelDoc2 Dim swModelDocExt As ModelDocExtension Dim swCustProp As CustomPropertyManager Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swModelDocExt = swModel.Extension Set swCustProp = swModelDocExt.CustomPropertyManager("") swCustProp.Add3 "ANumber", swCustomInfoType_e.swCustomInfoText, "123.4560", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd End Sub
Hope this works
I normally use "text" as the type and it works well, But for this macro, I was trying to duplicated work by someone else and needed to set the type as "number". It just seems odd that this has surfaced before in this forum.
Did some sampling...
Using swCustomInfoType_e.swCustomInfoNumber works good for integers.
Using swCustomInfoType_e.swCustomInfoDouble works good for numbers with decimals, not sure about the actual data type. (Long, Double or Decimal...).
lRetVal = cusPropMgr.Add3("ANUMBER", swCustomInfoType_e.swCustomInfoNumber, "123.456",
lRetVal = cusPropMgr.Add3("ANUMBER", swCustomInfoType_e.swCustomInfoDouble, "123.456",
and it will most likely work.
In the File -> Properties it will still say number for the custom property type, no matter which one of these enumerations that you use in the API.
My limited skills in coding and as I see it, the lack of details in the API reference for this does not tells me why... the lRetVal should have been 3 if this was the case, but it only returns as 0 or 1 in the sampling I did.
Thanks. Works great now. I should have seen this! Duh! Sometimes the obvious is oblivious.