.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA Acad 2010 vs Acad 2008

2 REPLIES 2
Reply
Message 1 of 3
Ray_Feiler
245 Views, 2 Replies

VBA Acad 2010 vs Acad 2008

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.
2 REPLIES 2
Message 2 of 3
_rhenley
in reply to: Ray_Feiler

Wrong newsgroup, please post this in the VBA newsgroup.

This may be the correct newsgroup if you wish to convert your obsolete VBA code to .NET though.
Message 3 of 3
Ray_Feiler
in reply to: Ray_Feiler

Thank you

Product Design & Manufacturing Collection 2024
Sometimes you just need a good old reboot.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost