Failure of VBA to connect to autocad (excel)

Failure of VBA to connect to autocad (excel)

Anonymous
Not applicable
6,457 Views
22 Replies
Message 1 of 23

Failure of VBA to connect to autocad (excel)

Anonymous
Not applicable

Have an application that worked for years, not no longer connects to autocad.  Using 2019 Electrical, with Excel 2016.

 

This is a section of the code that fails consistently with fault 429 - ActiveX component cant create object.

 

Any pointers would be greatly appreciated

 

 

Sub ConnectToAcad()
Dim AcadApp As AcadApplication
Set AcadApp = CreateObject("AutoCAD.Application")
' have tried - Set AcadApp = GetObject(,"AutoCAD.Application") ----- with same results
' have tried - Set AcadApp = New AcadApplication ----- with same results
AcadApp.Visible = True

AcadApp.ActiveDocument.Utility.Prompt "Excel Connected"

 

End Sub

0 Likes
6,458 Views
22 Replies
Replies (22)
Message 21 of 23

DavidTosh
Enthusiast
Enthusiast

I was having the same problem with AutoCAD 2021 and found I had to go into the Tools/References dialog, disable the AutoCAD type library for AutoCAD 2019 (apparently the last time I tried to do this 😉 and load the type library for AutoCAD 2021. This is found in the Program Files\Common Files\AutoCAD Shared as "acax24enu.tlb"

The "24" is the internal version number and "enu" is for English language installations.

 

Now, I'm sure I'll forget this when I next upgrade!

---
Tosh
0 Likes
Message 22 of 23

r_stella
Community Visitor
Community Visitor

Per poter usare Autocad 2025 in una PC dove è installato anche Autocad 2020?  

0 Likes
Message 23 of 23

Ed__Jobe
Mentor
Mentor

You can install AutoCAD 2025 on the same pc as 2020, but each one needs to have their own VBA module installed.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes