Solved

Visual Basic 6 "ActiveX can't create object" Autocad 2007

Posted on 2008-09-29
5
2,023 Views
Last Modified: 2013-12-04
I have a VB 6 app. that creates an autocad drawing from dimensional data entered by the user.  When the app gets to this line in the code "Set A2K = New AutoCAD.AcadApplication" I get the "ActiveX component cannot create object error."  Error 429.  The part that is odd is that if I run the application a second time the app runs fine with no errors.  If I wait a little while and run the app again the error returns and then the second time it runs fine again.  There must be something that is initialized the first time the Autocad dll tries to create a new acadapplication.  Does anyone have an idea on how to make this work on the first try?  Thanks in advance.
0
Comment
Question by:brettawv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
TreyH earned 500 total points
ID: 22602212
Have you tried? :
Dim A2K As AutoCAD.AcadApplication
Set A2K= CreateObject("AutoCAD.AcadApplication")

Or maybe until you find out what is wrong
On Error Resume Next
Set A2K = New AutoCAD.AcadApplication
If Error.Number = 429 Then
   'Try it again ..
   Set A2K = New AutoCAD.AcadApplication
End If
On Error Goto 0

0
 

Author Comment

by:brettawv
ID: 22605671
Create Object doesn't seem to work.  I'm actually trying a different version of Autocad now.  Autocad 2008.  I've switched to a vb.net app.  I'm creating a browser based entry screen for dimensional data.  Now I'm able to get the app to run in debug mode but it gives me a "Retrieving the COM class factory for component with CLSID {} failed due to the following error: 80080005".  Any ideas on what needs to be changed in my security settings.  I've already enabled several things in the DCOM configuration.  Any help is greatly appreciated.
0
 
LVL 11

Expert Comment

by:TreyH
ID: 22606358
Not much exp. with .net but you could try
adding this:
 <identity impersonate="true" userName="Domain\MyUsername" password="MyPassword"/>
(a valid admin account on the server)
in web.config after <authentication mode="Windows" />
0
 

Author Comment

by:brettawv
ID: 22608502
Already have the impersonate setup.  Back to using Autocad 2007.  I used your idea from above in the .net app.

         Try
            A2K = New Autodesk.AutoCAD.Interop.AcadApplication
        Catch
            A2K = New Autodesk.AutoCAD.Interop.AcadApplication
        End Try

Long pause first time through but hey it works.  Thanks for your help.

0
 
LVL 11

Expert Comment

by:TreyH
ID: 22611084
Thanks, wished it could have been a better solution than that. Ran across this link, seems they use GetObject first then try CreateObject. Might be worth a look.

http://www.kxcad.net/autodesk/autocad/Autodesk_AutoCAD_ActiveX_and_VBA_Developer_Guide/ws1a9193826455f5ff1a32d8d10ebc6b7ccc-6c91.htm
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question