AcadMtext, Type Mismatch

AcadMtext, Type Mismatch

Anonymous
Not applicable
1,404 Views
3 Replies
Message 1 of 4

AcadMtext, Type Mismatch

Anonymous
Not applicable

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

 

 

0 Likes
Accepted solutions (1)
1,405 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

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...

0 Likes
Message 3 of 4

Ed__Jobe
Mentor
Mentor
Accepted solution

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

0 Likes
Message 4 of 4

Anonymous
Not applicable

Got it working using late binding.  Thank you!

0 Likes