Wednesday, April 29, 2009

Learn how to migrate from VBA to .NET for AutoCAD

VBA is going away from AutoCAD in a coming release but ActiveX that is the API will remain so you can use the same API you are familiar with within .NET using COM Interop. So if you’re familiar with the ActiveX Object Model you get get up and running in .NET quicker.

In the four examples in this Autodesk Developer Network Network DevTV Visual Basic Express is used and you learn how to prepare code to use late binding and then export from VBA via VB6 format and end up with VB.NET code. There is even a great free macro that makes the VB6 project without requiring VB6.

AutoCAD VBA to .NET Migration Basics
view
download (140 Mb)
supporting files (1.72 Mb)

  • Example 1 is showing manual migration using VB6
  • Example 2 is showing the migration using the migration macro
  • Example 3 is dealing with user forms and problems with late binding and why it is good to change Object to something more specific using early binding
  • Example 4 is for referencing other type libraries than the AutoCAD ones. The example shows object referencing Excel and Word

Via Through the Interface

See also the posts More details on VBA in AutoCAD 2010 products, AutoCAD 2010 VBA and VSTA future and No VBA installed with AutoCAD 2010

No comments:

Post a Comment