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:
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:
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:
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.
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.