Accessing an existing instance of HyperACCESS from an Excel VBA macro

When an Excel VB macro uses HyperACCESS to log on and retrieve data, I would prefer to disconnect the existing HyperACCESS session but not quit the program. Then after processing data, I wish to connect and log back on. However, when HA is still on the Windows task bar, a second instance of HA is started. How do I get this to work properly?

There is an error in the HyperACCESS API manual on page 2-8. The error applies to programming in Excel. The GetObject in Excel requires a leading comma since HAWIN32 should be the SECOND argument.

Example: Set haAuto = GetObject(, “HAWIN32”)

The following code is required since the Program does not know if an another instance of HyperACCESS is already loaded.

On Error Resume Next
Set haAuto = GetObject(, “HAWIN32”)

‘err 429 = “ActiveX component can’t create object”
If Err.Number = 429 Then
Set haAuto = CreateObject(“HAWIN32”)

End If