Goodmorning,
I'm having a problem while trying to create a macro. I need it to add properties to a file depending on the type of the file itself (If Part/Assembly add "Data Dis", if Drawing add "Data Disegnato") but when I try to use it it gives me back a 424 error. What I'm doing wrong? Thanks in advice for the help
Dim retval As String
Set swApp = Application.SldWorks
MsgBox ("Firmato!")
Set swModel = swApp.ActiveDoc
retval = swModel.DeleteCustomInfo("Disegnato")
retval = swModel.DeleteCustomInfo("Data Disegnato")
retval = swModel.DeleteCustomInfo("Data Dis")
retval = swModel.DeleteCustomInfo("Dwg Type")
retval = swModel.AddCustomInfo3("", "Disegnato", swCustomInfoText, "SIB/LP")
retval = swModel.AddCustomInfo3("", "Dwg Type", swCustomInfoText, "Costruttivo")
Set Part.Type = Part.GetType
If Part.Type = swDocASSEMBLY Or Part.Type = swDocPART Then
retval = swModel.AddCustomInfo3("", "Data Dis", swCustomInfoText, Date)
End If
If Part.Type = swDocDRAWING Then
retval = swModel.AddCustomInfo3("", "Data Disegnato", swCustomInfoText, Date)
End If
End Sub
EDIT: I would also like to add a line to enter and exit "Modify sheet format" under the Drawing if. How can I do this?
SolidworksApi/macros