If it helps anyone avoid rewriting their VBA code base due to this issue, here is how we worked around it. We wrote a Lisp command in .NET (C#) that will create a record in an object table and attach it to an object. The object table name and object handle are passed to the Lisp command. The Lisp command can be called from VBA to create the record and attach it to an object. You can then edit the object data record as usual from within VBA.
The .NET Lisp Command:
public class Commands
{
[LispFunction("AttachObjectDataRecordToObject")]
public Object AttachObjectDataRecordToObject(ResultBuffer resultBuffer)
{
Object ret = null;
var editor = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue[] tvArr = resultBuffer.AsArray();
string tableName = tvArr[0].Value as String;
string objectHandle = tvArr[1].Value as String;
long handle = long.Parse(objectHandle, System.Globalization.NumberStyles.HexNumber);
Tables tables = HostMapApplicationServices.Application.ActiveProject.ODTables;
var objectId = HostApplicationServices.WorkingDatabase.GetObjectId(false, new Handle(handle), 0);
var table = tables[tableName];
using (var transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
{
//http://adndevblog.typepad.com/infrastructure/2012/05/adding-object-data-records-to-entity-using-map-...
var dbObj = transaction.GetObject(objectId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForWrite);
Record record = Record.Create();
table.InitRecord(record);
table.AddRecord(record, dbObj);
transaction.Commit();
}
return ret;
}
}
The VBA function to call the Lisp Command:
Public Function CreateRecordCommand(ByVal tableName As String, ByVal lngObjId As Long) As Boolean
Dim strCommand As String
Dim odRecordHandle As String
Dim objectHandle As String
CreateRecordCommand = False
objectHandle = GetHandle(lngObjId)
CreateRecordCommand = False
strCommand = "(ATTACHOBJECTDATARECORDTOOBJECT " & Chr(34) & tableName & Chr(34) & Chr(34) & objectHandle & Chr(34) & ") "
ThisDrawing.SendCommand strCommand
CreateRecordCommand = True
End Function
Public Function GetHandle(ByVal longObjId As Long)
Dim object As AcadObject
Set object = ThisDrawing.ObjectIdToObject32(longObjId)
GetHandle = object.handle
End Function