Hi all
I don't master VBA very well and I fiddle a little...
So I created this macro (by copying it and adding my properties) but I would like the created properties to be put in the "Customize" tab and not in "Configuration specific". Could you correct my macro please? Thank you in advance.
Dim swApp As Object
Dim swModel As ModelDoc2
Dim config As SldWorks.Configuration
Dim swCustProp As CustomPropertyManager
Dim lRetVal As Long
Dim myValue0 As String
Dim myValue1 As String
Dim myValue2 As String
Dim myValue3 As String
Dim myValue4 As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
my0Value = swModel.GetTitle 'We get the file name
myValue1 = Left(myValue0, 16) 'We get the part number, so the first 16 characters of the file name
myValue2 = Left(myValue0, 22) 'We get the first 22 characters of the file name
myValue3 = Right(myValue0, Len(myValue0) - Len(myValue2)) 'We get the Designation last characters of the file name - the first 22
myValue4 = Left(myValue0, 13) 'We get the mold number
Set config = swModel.GetActiveConfiguration
Set cusPropMgr = config. CustomPropertyManager
lRetVal = cusPropMgr.Add3("PartNumber", swCustomInfoType_e.swCustomInfoText, myValue1, swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
lRetVal = cusPropMgr.Add3("Designation", swCustomInfoType_e.swCustomInfoText, myValue3, swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
lRetVal = cusPropMgr.Add3("DocumentSource", swCustomInfoType_e.swCustomInfoText, myValue4, swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
End Sub
If you have a good tutorial to recommend for the VBA Solidworks I'm all for it.