Overview of AutoCAD Visual Basic for Applications (VBA) Interface

AutoCAD ActiveX

 
Overview of AutoCAD Visual Basic for Applications (VBA) Interface
 
 
 

Microsoft VBA is an object-oriented programming environment designed to provide rich development capabilities similar to those of Visual Basic 6 (VB). The main difference between VBA and VB is that VBA runs in the same process space as AutoCAD, providing an AutoCAD-intelligent and very fast programming environment.

VBA also provides application integration with other VBA-enabled applications. This means that AutoCAD, using other application object libraries, can be an Automation controller for other applications such as Microsoft Word or Excel.

The standalone development editions of Visual Basic 6, which must be purchased separately, complement AutoCAD VBA with additional components, such as an external database engine and report-writing capabilities.

There are four advantages to implementing VBA for AutoCAD:

  • VBA and its environment are easy to learn and use.
  • VBA runs in-process with AutoCAD. This translates to very fast program execution.
  • Dialog box construction is quick and effective. This allows developers to prototype applications and quickly receive feedback on designs.
  • Projects can be standalone or embedded in drawings. This choice allows developers great flexibility in the distribution of their applications.
NoteMicrosoft has not promised to provide 64-bit VBA SDK libraries (.dll). Subsequently, 64-bit AutoCAD can no longer run VBA as an in-proc component; VBA components now run as 32-bit out-of-process COM components, and provides a stopgap arrangement for 64-bit AutoCAD VBA users. This arrangement might require a few changes to existing VBA code. This stopgap provision would be deprecated in future versions of AutoCAD and it is advisable for the users to port their exisiting VBA code to VB. NET.