none
createobject("autocad.application.18") gives ActiveX error in VB

    Question

  • I have a program that is able to print selected drawings to a printer near the person who requested the drawing.
    recently we updated from autocad 2008 and inventor 2008 to autocad 2010 en inventor 2010.
    With opening of inventor 2010 I don't have any problems.
    I'm usung visual studio 2005

    I open autocad with the following text:

    dim acad as object
    
    acad =createobject("autocad.application.18")
    
    acad.visible =  true
    up to autocad 2008 (17.1) this constuction worked fine

    but now this construction works fine when there is no database in my project but as soon as I add my  acces database the line
    acad =createobject("autocad.application.18")
    gives the following error : "Cannot create ActiveX component."


    I tried it also with an empty acces database, that gives the same result.


    could someone please help me?

    Monday, September 21, 2009 8:06 AM

Answers

  • could you be a bit more specific because i don't know what you mean
    What Cor means is that you use a managed code instead of relying on legacy automation that is very popular in VB6 or VBA.

    One of the pitfalls in using Automation is "versioning ", thus I suspect this line of code:

    acad =createobject("autocad.application.xx
    ")
     
    I guess you need to check the version of AutoCAD 2010 as it could be something else.

    Have a lovely day
    Waleed El-Badry ,Teaching Assistant, Faculty of Engineering , Misr University for Science & Technology
    • Marked as answer by Jeff Shan Monday, September 28, 2009 1:16 AM
    Monday, September 21, 2009 1:09 PM

All replies

  • Did you already try to put a reference to it and quit that VBS code in your VB Net application?
    Success
    Cor
    Monday, September 21, 2009 10:32 AM
  • Hello Vermeulen,
    You may use this project:

    AutoCAD managed Project for VB.NET




       Fig. Screen Shot of the managed AutoCAD Project

    Have a lovely day
    Waleed El-Badry ,Teaching Assistant, Faculty of Engineering , Misr University for Science & Technology
    • Marked as answer by Jeff Shan Monday, September 28, 2009 1:16 AM
    • Unmarked as answer by Vermeulen Thursday, October 01, 2009 9:21 AM
    Monday, September 21, 2009 10:45 AM
  • could you be a bit more specific because i don't know what you mean
    Monday, September 21, 2009 1:00 PM
  • could you be a bit more specific because i don't know what you mean
    What Cor means is that you use a managed code instead of relying on legacy automation that is very popular in VB6 or VBA.

    One of the pitfalls in using Automation is "versioning ", thus I suspect this line of code:

    acad =createobject("autocad.application.xx
    ")
     
    I guess you need to check the version of AutoCAD 2010 as it could be something else.

    Have a lovely day
    Waleed El-Badry ,Teaching Assistant, Faculty of Engineering , Misr University for Science & Technology
    • Marked as answer by Jeff Shan Monday, September 28, 2009 1:16 AM
    Monday, September 21, 2009 1:09 PM
  • I have tried :  acad =createobject("autocad.application") it sometimes starts autocad 2010 but most of the times it give ActiveX error.

    now I have changed the code to

                Try
                    Acad = CreateObject("Autocad.Application.18") 'maak object en open acad
                Catch ex As Exception
                    Try
                        Acad = CreateObject("Autocad.Application.17.1") 'maak object en open acad
                    Catch ex1 As Exception
                    End Try
                End Try
    

    When I restart my computer the first 2-3 times is starts Autocad 2010 directly and for the rest of the time its like playing the lotto or it starts Autocad 2010 or it starts Autocad 2008, I still don't have a solution and I don't know where to look anymore
    Friday, September 25, 2009 9:35 AM
  • Did you look at the solution Waleed proposed to you?

    Seems to me more stable than this method from the time of Willem Drees
    Success
    Cor
    Friday, September 25, 2009 10:31 AM
  • Make sure to dispose your Acad object before creating another one. Again COM has unexpected behavior since CLR wraps it. Cheers
    Waleed El-Badry ,Teaching Assistant, Faculty of Engineering , Misr University for Science & Technology
    • Marked as answer by Jeff Shan Monday, September 28, 2009 1:16 AM
    • Unmarked as answer by Vermeulen Thursday, October 01, 2009 8:09 AM
    Friday, September 25, 2009 1:59 PM
  • tried it but it didn't start the wizard in vb 2005
    Thursday, October 01, 2009 8:09 AM