CreateObject("Acad.Application") giving activeX error 429

CreateObject("Acad.Application") giving activeX error 429

Anonymous
Not applicable
5,224 Views
6 Replies
Message 1 of 7

CreateObject("Acad.Application") giving activeX error 429

Anonymous
Not applicable

I'm having some issues with some code I developed in an excel workbook.  I open autocad and run a macro based for a certain filename.  It works perfectly on my machine which is running Autocad 2014 but when I go run it on another computer which has Autocad 2016 I get the error 429 ActiveX can't create object.  I don't have any references in VBA to autocad libraries or anything.

 

Public Function RUNproject(ByVal ProjectPath As String, ByVal MacroName As String, ByVal ACADDocName As String)
 
On Error GoTo newACAD
Set ObjACAD = GetObject(, "AutoCAD.Application")

newACAD:
If ObjACAD Is Nothing Then
    Set ObjACAD = CreateObject("AutoCAD.Application")
    ObjACAD.Visible = True
    ObjACAD.WindowState = 2
End If

ObjACAD.Documents.Open (ACADDocName)
 

Set ThisDrawing = ObjACAD.ActiveDocument
 
Dim FileName As String
FileName = ProjectPath
' Load a sample VBA project DVB file create with AutoCAD
ObjACAD.LoadDVB FileName
' Run the macro
ObjACAD.runmacro MacroName 'enter the module and routine/function name

ThisDrawing.Close
'objAcad.Documents.Close

Exit_Here:
Exit Function
Err_Control:
MsgBox Err.Description
Resume Exit_Here
End Function
0 Likes
Accepted solutions (1)
5,225 Views
6 Replies
Replies (6)
Message 2 of 7

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> It works perfectly on my machine which is running Autocad 2014 but when I go run it on another

>> computer which has Autocad 2016 I get the error 429 ActiveX can't create object.

Have you updated the references from AutoCAD 2014 to AutoCAD 2016 or is your code working in late-binding mode?

 

And it would be great to know at which line exactly the exception appears. If I'm correct with guessing I think it's the code line with ....createObject, correct?

What happens when you try this versions:

 

Set ObjACAD = CreateObject("AutoCAD.Application.20")
or
Set ObjACAD = CreateObject("AutoCAD.Application.20.1")

Is one of these lines working?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 7

Anonymous
Not applicable

@Alfred.NESWADBA wrote:

Hi,

 

>> It works perfectly on my machine which is running Autocad 2014 but when I go run it on another

>> computer which has Autocad 2016 I get the error 429 ActiveX can't create object.

Have you updated the references from AutoCAD 2014 to AutoCAD 2016 or is your code working in late-binding mode?

 

And it would be great to know at which line exactly the exception appears. If I'm correct with guessing I think it's the code line with ....createObject, correct?

What happens when you try this versions:

 

Set ObjACAD = CreateObject("AutoCAD.Application.20")
or
Set ObjACAD = CreateObject("AutoCAD.Application.20.1")

Is one of these lines working?

 

- alfred -


My code was working in late-binding mode (or trying to atleast).

 

You are correct that the exception appears in the createobject line.

 

I had tried the .20 line and had no luck there (still a 429 error).  I hadn't tried the .20.1 line but I'm guessing that wouldn't work on my computer (running Autocad 2014) since that would be AutoCAD.Application.19?

 

I ended up just updating my Autocad to 2016 and changing my Autocad reference for early binding and now I am working smoothly accross all computer running Autocad 2016.  I was trying to avoid "versioning" my code that way this code would work even if we update Autocad in the future, but I guess I can just update the references when the time comes.

 

Thank you for your help.

0 Likes
Message 4 of 7

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

>> I hadn't tried the .20.1 line but I'm guessing that wouldn't work on my computer (running Autocad 2014)

Your question was that this code is not running on 2016, so I thought you search for a solution to get our code working with 2016 ... so 20.1 would be worth to be tried (imho).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 5 of 7

Anonymous
Not applicable
I went back a revision to when I was using late binding and the 20.1 seems to be working. Thank you for your help.
0 Likes
Message 6 of 7

Anonymous
Not applicable

 

 

 

Set ObjACAD = CreateObject("AutoCAD.Application.20.1")

 

It doesn´t work with Autocad 2016 LT

 

What can I do?

 

0 Likes
Message 7 of 7

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> It doesn´t work with Autocad 2016 LT

AutoCAD LT does not have a development API (that's part of the cheaper price)

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes