Run-time error -2147221164 (80040154) Class not registered

Yusuf 711 Reputation points
2022-03-13T22:09:26.993+00:00

Hi,
I applied this tutorial for using .Net in Micrsoft Office, I used Visual Studio 2022 Current and .Net Framework 4.7.2 and Microsoft Access 2016
I didn't see Intellisense when writing code, and when I execute I get the error: Class not registerd

182602-image.png

Help button take me to this link
I re-installed Office and repaired the system using the sfc command
But that didn't fix this error.

Thank you in advance for your assistance

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,616 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
841 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 41,696 Reputation points
    2022-03-14T08:44:53.8+00:00

    There are a couple of things that could cause the "Class not registered" error -

    1. Do NOT build your class library for AnyCPU. If you are using a 64-bit version of Office then build for x64. If 32-bit then build for x86. This will ensure that Visual Studio performs COM registration in the appropriate registry locations.
    2. Make sure that you have checked the boxes in the project properties to "Register for COM interop" and "Make assembly COM-Visible".
    3. When building your project run Visual Studio as an Administrator with elevated privileges. This is required for successful COM registration. If you do not run it as an Administrator the class library will be created but COM registration will fail.

    In your Office application VBA Editor Tools->References find your project "ComTest". You must check the box for Intellisense to work.


0 additional answers

Sort by: Most helpful