Run-time error '-2147417848 (80010108)' while trying to store ribbon to memory

ryancgarrett

Board Regular
Joined
Jun 18, 2011
Messages
122
I've run in to a bit of a quandary with an add-in I have developed for a client. After a lot of work and testing on my machine I distributed the add-in yesterday. The user received two files, the actual add-in and an "installer" that set up user credentials for the user.

The add-in installed correctly, as I walked the client through the process over the phone. He opened a new instance of Excel and the "Launch Add-In" button I had created on the data tab appeared as it should have. He clicked on the button, entered his user credentials and pressed "Start." This should run a procedure which verifies his credentials and then shows a few custom ribbon tabs. Instead he immediately got this error:

Run-time error '-2147417848 (80010108)':

Automation error
The object invoked has disconnected from its clients.

There was no debug option available, even after I had him "unlock" the code and repeat the process. After stepping through the code with him I realized the error is occurring here:

Code:
Function GetRibbon(lngRibPtr As Long) As Object
Dim objRibbon As Object


    CopyMemory objRibbon, lngRibPtr, 4
    Set GetRibbon = objRibbon
    'clean up invalid object
    CopyMemory objRibbon, 0&, 4
    Set objRibbon = Nothing
End Function

As I said, this code works fine on my computer, but stalls every time the client runs it. We are both using Excel 2010, but I am in Windows 8 while he is in Windows 7. Other than that I can't figure out any differences. I use the following code at the top of my module to declare the "CopyMemory" procedure:

Code:
#If VBA7 Then    Public Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (ByRef destination As Any, ByRef source As Any, ByVal length As Long)
#Else
    Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (ByRef destination As Any, ByRef source As Any, ByVal length As Long)
#End If

Any suggestions would be great, I have searched all over but have not found any solutions pertinent to my issue. It seems most users run into this error when cutting and pasting between different workbooks. Thanks in advance.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top