sanderson Posted March 8, 2010 Share Posted March 8, 2010 For some strange reason, I'm having a struggle to launch AutoCAD. I am getting the error 'Cannot create ActiveX component.' for this code, here... acadapp2009 = CreateObject("AutoCAD.Application.17.2") Imports Autodesk.AutoCAD.Interop Imports Autodesk.AutoCAD.Interop.AcadDocumentClass Imports Autodesk.AutoCAD.Interop.Common PublicClass Form1 ' Public WithEvents AcadApp2009 As Autodesk.AutoCAD.Interop.AcadApplication ' Public acadapp2009 As Autodesk.AutoCAD.Interop.AcadApplication Public acadapp2009 AsObject PublicSub LoadProfile(ByVal ProfileName AsString, ByVal ProfileFile AsString) Try acadapp2009 = GetObject(, "AutoCAD.Application.17.2") Catch ex As Exception acadapp2009 = CreateObject("AutoCAD.Application.17.2") EndTry Dim acaddoc As Autodesk.AutoCAD.Interop.AcadDocument = AcadApp2009.ActiveDocument With AcadApp2009.Preferences.Profiles .importfile(ProfileName, ProfileFile, True) EndWith EndSub The same code works great with AutoCAD 2006 - version 16. Strange, because the application does open, but the code stops and errors out. Do I need to add a timeout, or do until somewhere? Thanks in advance for the help. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.