'VBA QuickBooks: Class not registered

My long-time running MS Access application will no longer create QuickBooks invoices and is failing on the OpenConnection line with the following error:

HRESULT -2147221164 (8004154) Class not registered

My relevant code is:

 Option Compare Database

Public requestMsgSet As QBFC2Lib.IMsgSetRequest ' QB global variable
Public booSessionBegun As Boolean ' QB global variable
Public Response As QBFC2Lib.IResponse ' QB global variable
Public responseMsgSet As QBFC2Lib.IMsgSetResponse ' QB global variable
Public sessionManager As New QBFC2Lib.QBSessionManager ' QB global variable
Public invoiceLineAdd As QBFC2Lib.IInvoiceLineAdd ' QB global variable
Public invoiceAdd As QBFC2Lib.IInvoiceAdd ' QB global variable
Public OrientIDHolder As Integer
Public MultipleInvoice As Boolean ' QB global variable

'False until session is begun
booSessionBegun = False

' Create the session manager object using QBFC 2.0, and use this
' object to open a connection and begin a session with QuickBooks.
sessionManager.OpenConnection "AZENCODE02", "Database - QuickBooks invoice add"
sessionManager.BeginSession "", QBFC2Lib.omDontCare
booSessionBegun = True ' Session has begun

The error is in the QuickBooks.sessionManager.OpenConnection line but I cannot figure out what is happening.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source