I maintain an Excel workbook with a bunch of VBA macros in it. The workbook has been in use for the past few months, mostly without any incident. We have a VBA function that is used to call other VBA functions. The purpose of it is to back up clipboard data, run the function, then restore clipboard data. It's pretty simple.
Sub FunctionHandler()
Dim clipboardData As New DataObject
clipboardData.GetFromClipboard
'' There are a dozen or so macros that can be called here
Call AnyFunction()
On Error Resume Next
clipboardData.PutInClipboard
On Error GoTo 0
End Sub
The VBA project includes a reference to Microsoft Forms 2.0 Object Library (FM20.DLL), which is needed to use the DataObject class.
On everyone's computer except mine, the function works as it should. It backs up the clipboard data, runs the function, and restores the clipboard contents.
The issue is only occurring on my computer. Whenever I run this function, and I have an empty clipboard, or plain text copied to the clipboard (it could be copied from excel or from an outside source like notepad), an error is thrown. The text of the error is
Run-time error '-2147467263 (80004001)':
DataObject:PutInClipboard Not implemented.
The error is thrown on the line clipboardData.PutInClipboard
. It is never thrown the call to clipboardData.GetFromClipboard
. Which to me means that the reference to the Microsoft Forms 2.0 Object Library is not having any issues.
The error is also not thrown if I copy a cell or range to the clipboard before running this macro. Only when the clipboard is empty or contains plain text data.
The error has never popped up on anyone else's computer at my job. I have made sure that the FM20.DLL exists in the correct folder on my computer. I have restarted Excel and my computer but the issue persists.
I get the same error when I reduce the code down to this.
Sub FunctionHandler()
Dim clipboardData As New DataObject
clipboardData.GetFromClipboard
clipboardData.PutInClipboard
End Sub
I also have multiple full backup copies of the workbook, and every single backup that has this function is giving me the same issues (but again, only me).
Does anyone know how I can fix this?
EDIT: This issue does not happen when using a new Windows profile on my computer.