Creating a New AutoCAD Object

Creating new objects in 64-bit AutoCAD with the AutoCAD COM API.

Supported platform: Windows only

Supported releases: AutoCAD 2014 and earlier

VB’s New keyword will attempt to load 64-bit AutoCAD COM DLLs. Since VBA is a 32-bit application, it cannot load 64-bit DLLs; thus, any attempt to create a new AutoCAD object type will result in an error. For example, code such as

Dim anyAcadObject As AcAnyObject
Set anyAcadObject = New AcAnyObject

or

Dim anyAcadObject As New AcAnyObject
AcAnyObject.SomeMethod()

will need to be modified.

To solve this issue, use AcadApplication.GetInterfaceObject(ProgIdOfAcAnyObject) for any object which derives from IDispatch. Classes that derive from IUnknown (e.g.AcSmSheetSet, AcSmSheetMgr) is not expected to have a 64-Bit VBA migration. It is recommended that users port such processes to VB.NET.