Autocad 2022 VBA Automation error using CreateObject("VL.Application.16")

Autocad 2022 VBA Automation error using CreateObject("VL.Application.16")

A.vanNieuwenhuize
Participant Participant
1,482 Views
5 Replies
Message 1 of 6

Autocad 2022 VBA Automation error using CreateObject("VL.Application.16")

A.vanNieuwenhuize
Participant
Participant

Hi,

I have used  "CreateObject("VL.Application.16") " upto autocad 2018i to

get lisp variables into VBA macro's.

example:

Set objVisualLisp = CreateObject("VL.Application.16")

With objVisualLisp.ActiveDocument.Functions
Set objSymbol = .item("read").funcall("H:ExcelShareName")
GetPathFormSymbol = .item("eval").funcall(objSymbol)
End With

 

While using Autocad 2022 the next  Automation error is fired

run-time error '-2147220999 (800401f9)': 

Automation error

Error in the DLL

Who can help me with this problem

 

Ad ios

 

 

0 Likes
1,483 Views
5 Replies
Replies (5)
Message 2 of 6

Ed__Jobe
Mentor
Mentor

I'm running 2021 and the class name is still "VL.Application.16". Which line is giving the error? If its the CreateObject line, have you tried repairing AutoCAD?

 

Just to be certain, you are running this code inside AutoCAD?

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
Message 3 of 6

A.vanNieuwenhuize
Participant
Participant

Ed thanks for your fast reply.

I am talking about Autcad 2022 and not 2021.

The line CreateObject("VL.Application.16") is firing the error message.

 

Ad ios

0 Likes
Message 4 of 6

A.vanNieuwenhuize
Participant
Participant
Ed thanks for your fast reply.

I am talking about Autcad 2022 and not 2021.

The line CreateObject("VL.Application.16") is firing the error message.
0 Likes
Message 5 of 6

Ed__Jobe
Mentor
Mentor

It's still the same for 2022. You didn't answer if you tried to repair the AutoCAD installation.

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
Message 6 of 6

norman.yuan
Mentor
Mentor

@A.vanNieuwenhuize ,

 

I just got a 2022 AutoCAD vertical (Plant3D) installed,  did test and found interesting change on this:

 

This line of code:

 

Set objVisualLisp = CreateObject("VL.Application.16")

 

works for older version of AutoCAD (I only has 2020 and 2021, no anything older accessible for now). But indeed it raises exception with Acad2022.

 

While this line of code:

 

Set objVisualLisp = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")

 

works on all versions of AutoCAD (again, I only have Acad2020 and up).

 

Whatever changes, in my view, as AutoCAD programmer, GetInterfaceObject() should be the right approach to instantiate an object that is not a direct part of AutoCAD COM Model, but runs inside AutoCAD process and interacts with AutoCAD objects, whereas CreateObject() is used to instantiate object that runs outside of AutoCAD process. So, whatever Acad2022 does that causes this change/error, it is technically right thing to do, but it unfortunately breaks some existing code, as yours.

 

 

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes