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

Link excel (office 365 -64bit) with autocad2022(64bit)-Run-time error '-2147221164 (80040154)'

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
peterbXL78W
1049 Views, 4 Replies

Link excel (office 365 -64bit) with autocad2022(64bit)-Run-time error '-2147221164 (80040154)'

peterbXL78W
Explorer
Explorer

Hi all of you,

after upgrading the newest autocad2022 my excel program can not connect to autocad. Excel program was done in 2010 via visual basic. I use it to read objects from autocad and create list in excel sheet. It stops at stage launching autocad with error message Run-time error '-2147221164 (80040154)' class not registered.

Ive tried repair and reinstal office from 64bit to 32bit. However without succes. It always stucks after clicking debug

at launch autocad. It highlights in yellow(Set AcadApp = New AcadApplication) please see part of scrip below

 

' launch AutoCAD
Set AcadApp = New AcadApplication

' open the AutoCAD drawing
AcadApp.Documents.Open file_path
errors:
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
AcadApp.Application.Visible = True
Set ssAperture = AcadApp.ActiveDocument.SelectionSets.Add("SS1")
FilterType(0) = 8
FilterData(0) = "TF EXT APERTURE"

ssAperture.SelectOnScreen FilterType, FilterData
On Error GoTo End10
If ssAperture.Count = 0 Then
AcadApp.ActiveDocument.SelectionSets.Item("SS1").Delete
GoTo errors
Else
End If

0 Likes

Link excel (office 365 -64bit) with autocad2022(64bit)-Run-time error '-2147221164 (80040154)'

Hi all of you,

after upgrading the newest autocad2022 my excel program can not connect to autocad. Excel program was done in 2010 via visual basic. I use it to read objects from autocad and create list in excel sheet. It stops at stage launching autocad with error message Run-time error '-2147221164 (80040154)' class not registered.

Ive tried repair and reinstal office from 64bit to 32bit. However without succes. It always stucks after clicking debug

at launch autocad. It highlights in yellow(Set AcadApp = New AcadApplication) please see part of scrip below

 

' launch AutoCAD
Set AcadApp = New AcadApplication

' open the AutoCAD drawing
AcadApp.Documents.Open file_path
errors:
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
AcadApp.Application.Visible = True
Set ssAperture = AcadApp.ActiveDocument.SelectionSets.Add("SS1")
FilterType(0) = 8
FilterData(0) = "TF EXT APERTURE"

ssAperture.SelectOnScreen FilterType, FilterData
On Error GoTo End10
If ssAperture.Count = 0 Then
AcadApp.ActiveDocument.SelectionSets.Item("SS1").Delete
GoTo errors
Else
End If

4 REPLIES 4
Message 2 of 5
grobnik
in reply to: peterbXL78W

grobnik
Collaborator
Collaborator
I Guess it's related to reference library updated on Autocad side but not on
Excel (office) side.

Check your reference library in your drawing, before activating macro, you
should select the oldest one, and not newest.

On VBA check tools open, a dialog like the below will appear, select the
oldest excel library and disable newest.


0 Likes

I Guess it's related to reference library updated on Autocad side but not on
Excel (office) side.

Check your reference library in your drawing, before activating macro, you
should select the oldest one, and not newest.

On VBA check tools open, a dialog like the below will appear, select the
oldest excel library and disable newest.


Message 3 of 5
ed57gmc
in reply to: grobnik

ed57gmc
Mentor
Mentor
Accepted solution

I think it's the other way around. They need to to to Tools>References in Excel ide and uncheck the "MISSING:" reference, then select the correct tlb for AutoCAD 2022.

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

I think it's the other way around. They need to to to Tools>References in Excel ide and uncheck the "MISSING:" reference, then select the correct tlb for AutoCAD 2022.

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 5
norman.yuan
in reply to: peterbXL78W

norman.yuan
Mentor
Mentor
Accepted solution

Just want to confirm that when you say "...Excel program was done in 2010 via visual basic...", you mean it is an Excel VBA program, running inside Excel, the Excel itself is 64-bit (part of Office 365), the the VBA code was originally against AutoCAD 2010. And now the AutoCAD is upgraded to AutoCAD 2022.

 

You simply open the Excel's VBA editor, click menu "Tools"->"References...". In the dialog box, looking for the checked reference to "AutoCAD20xx Type Library". That reference may still set to AutoCAD2010. If so, you need to uncheck it and find "AutoCAD 2021 Type Library" (AutoCAD 2021 and 2022 both come with "AutoCAD 2021 Type Library" for their COM API). Make sure you tick the check box and OK the dialog box. Then you may want to click menu "Debug->Compile xxxxx" to make sure the VBA code can pass the compile. 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes

Just want to confirm that when you say "...Excel program was done in 2010 via visual basic...", you mean it is an Excel VBA program, running inside Excel, the Excel itself is 64-bit (part of Office 365), the the VBA code was originally against AutoCAD 2010. And now the AutoCAD is upgraded to AutoCAD 2022.

 

You simply open the Excel's VBA editor, click menu "Tools"->"References...". In the dialog box, looking for the checked reference to "AutoCAD20xx Type Library". That reference may still set to AutoCAD2010. If so, you need to uncheck it and find "AutoCAD 2021 Type Library" (AutoCAD 2021 and 2022 both come with "AutoCAD 2021 Type Library" for their COM API). Make sure you tick the check box and OK the dialog box. Then you may want to click menu "Debug->Compile xxxxx" to make sure the VBA code can pass the compile. 

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5
peterbXL78W
in reply to: norman.yuan

peterbXL78W
Explorer
Explorer

Briliant, it start working after setting new autocad library. Thank you very much...nobody on the planet earth didnt know what to do except you. You made me the happiest person on planet. Thanks so much

0 Likes

Briliant, it start working after setting new autocad library. Thank you very much...nobody on the planet earth didnt know what to do except you. You made me the happiest person on planet. Thanks so much

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report