VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AcadMtext, Type Mismatch

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
tdeatonDB7WU
938 Views, 3 Replies

AcadMtext, Type Mismatch

So, I am using the code below to add text to my document in paper space.  The weird thing is, this worked amazingly in AutoCad 2017.  The problem I am now having is that I have upgraded to AutoCad 2021 and I am now getting the error shown (Type Mismatch) on the highlighted line in the code below.  Another weird thing is that it will actually output my text but will not alter the height or color because my code stops after the error, so nothing runs after that error.  Please help!

 

tdeatonDB7WU_1-1613166607354.png

 

tdeatonDB7WU_2-1613166728732.png

 

 

3 REPLIES 3
Message 2 of 4
tdeatonDB7WU
in reply to: tdeatonDB7WU

Update: I'm using Excel VBA

 

also, when I run the program for 2021 AutoCad and get the error, and then go back to try and use it in 2017 I get the same error, even though it worked in 2017 before...

Message 3 of 4
Ed.Jobe
in reply to: tdeatonDB7WU

If you were using AutoCAD VBA, it would automatically reference the correct tlb. Since you are working in xl, you need to reference the 2021 tlb. When you use GetObject and CreateObject with the version id in the class name, it calls that specific version of AutoCAD. Also, you can't use the VBA project with more than one version of AutoCAD using early binding. If you need to use it with multiple versions of AutoCAD, you must use late binding and remove the reference to the acad tlb.

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

Message 4 of 4
tdeatonDB7WU
in reply to: Ed.Jobe

Got it working using late binding.  Thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost