Tuesday, July 17, 2007

Launch AutoCAD 2004 from VB.NET

' Get the active session of AutoCAD 2004 using late binding AcadApp = GetObject(, "AutoCAD.Application.16") If Err.Number <> 0 Then Err.Clear() Shell("c:\Program Files\Common Files\Autodesk Shared\WSCommCntr1.exe", AppWinStyle.NormalFocus) ' Create a new session of AutoCAD 2004 using late binding AcadApp = CreateObject("AutoCAD.Application.16") If Err.Number <> 0 Then MsgBox("Error, could not create a new AutoCAD session") End End If End If AcadApp.Visible = True

The workaround seems to be to start WSCommCntr1.exe before running CreateObject.

This is probably true for AutoCAD 2005 as well as if done using VB6.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner