Problem in loading Application

Problem in loading Application

Anonymous
Not applicable
6,023 Views
7 Replies
Message 1 of 8

Problem in loading Application

Anonymous
Not applicable

I have a VBA program for in which I am getting error as 

Run time error'-2147221005(800401f3)':

Problem in loading application for the code

 

Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.2")

 

I have 64 bit system

 

Can anyone please give solution for this

thanks

 

0 Likes
Accepted solutions (2)
6,024 Views
7 Replies
Replies (7)
Message 2 of 8

norman.yuan
Mentor
Mentor
Accepted solution

The ProgId argument you passed into GetInterfaceObject() method is probably wrong. It should be like

"AutoCAD.AcCmColor.xx", where xx is AutoCAD version, which must be a 2-digit number, because the very early version of AutoCAD, when it had 1-digit version number, did not have AcCmColor class used then.

 

You did not say whichversion of AutoCAD you use, so here is what you need to use

For Acad2015, use AutoCAD.AcCmColor.20

For Acad2016/17, use AutoCAD.AcCmColor.21

For Acad2018, use AutoCAd.AcCmColor.22

For Acad2019, use AutoCAD.AcCmColor.23

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 8

Anonymous
Not applicable

Thanks

0 Likes
Message 4 of 8

rmcefr
Enthusiast
Enthusiast

Hello Sir

what about if we use autoCAD2021 , what is the ProgId here?

 

thanks

0 Likes
Message 5 of 8

rmcefr
Enthusiast
Enthusiast

it is ok we have to use "AutoCAD.AcCmColor.23"

0 Likes
Message 6 of 8

norman.yuan
Mentor
Mentor
Accepted solution

You could have found it out easily/quickly by looking up windows registry "\HKEY_CLASSES_ROOT\AutoCAD.AcCmColor.XX"

For AutoCAD2019 and 2020, it is "AutoCAD.AcCmColor.23", or AutoCAD2021, it is "AutoCAD.AcCmColor.24".

 

No, it is not OK to use the ProgID for wrong version of AutoCAD.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 7 of 8

rmcefr
Enthusiast
Enthusiast

Yes Sir 24, sorry

0 Likes
Message 8 of 8

Anonymous
Not applicable

I found this from AUGI Forum : 

Dim sVer As String = Left(acadDoc.GetVariable("ACADVER"), 2)
Set Color = acadApp.GetInterfaceObject("AutoCAD.AcCmColor." & sVer)

Hope this help.

0 Likes