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!
Solved! Go to Solution.
Solved by Ed.Jobe. Go to Solution.
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...
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.