The following Macro will add 2 custom properties if missing in AutoCAD 2008 but will not in AutoCAD 2010. What changed?
Public Sub AddCustomProps()
Dim Key0 As String
Dim Value0 As String
Dim Key1 As String
Dim Value1 As String
Dim CustomPropertyStatus As String
Dim PropertyStatusValue As String
Dim CustomPropertyLine As String
Dim PropertyLineValue As String
On Error GoTo ErrorHandler
CustomPropertyStatus = "Status"
ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
PropertyStatusValue = "Preliminary"
CustomPropertyLine = "Line"
ThisDrawing.SummaryInfo.GetCustomByIndex 1, Key1, Value1
PropertyLineValue = Value1
On Error Resume Next ' Defer error trapping.
ErrorHandler:
If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyStatus, PropertyStatusValue
Else
ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyStatus, PropertyStatusValue
End If
If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
ThisDrawing.SummaryInfo.SetCustomByIndex 1, CustomPropertyLine, PropertyLineValue
Else
ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyLine, PropertyLineValue
End If
Resume
End Sub
Thank you for any help you can provide.
Ray
Product Design & Manufacturing Collection 2024
Sometimes you just need a good old reboot.