I'm porting over an old C# com addin to exceldna and I'm having trouble creating an instance of the RTD Sever via VBA.
The class definition looks like this:
[ComVisible(true), Guid("01311A15-E3E9-48A0-B3CB-6432FD76AB62"), ProgId("Eclipse.RtdServer")]
public class EclipseRTDServer : IRtdServer, ITopicListProvider
{
...
}
I can access the server via the RTD function from the spreadsheet, but I get "Run-time error '424': Object required" when I try to access it via VBA:
Sub Test()
Dim es As Object
Set es = CreateObject("eclipse.rtdserver")
...
Set es = Nothing
End Sub
Some other info:
- The constructor of the class EclipseRTDServer does get called when I call CreateObject and it returns with no errors
- No exceptions are thrown in the C# code (I've stepped through the code in Visual Studio)
- I can create an instance of any other class via CreateObject() so long as it does not have the IRtdServer interface on it (as soon as I add the interface I get the error).
- If I remove the 'IRtdServer' interface from the class I can create it using VBA, but obviously no longer works as an RTD server
- I have tried the above with ClassInterfaceTypes: None, AutoDispatch an AutoDual
- I have tried implementing my own copies of the IRtdServer/IRTDUpdateEvent interfaces (using the same guids)
- This works without issue in the old COM version (which is registered with regsrv32)
- I have tried extending ExcelRTDServer - this fails also but I get an additional error different error about the base class not being marked as com visible
- I've tried with 0.34.6 and 0.35.1-beta2
- I've tried creating a very basic project from scratch with no dependencies other than exceldna - the issue still happens
- I have set ComServer=True in the dna file, and call ComServer.DllRegisterServer / Unregister in the Addin
- The issue happens in Excel 2007 and 2016 (64 bit) on multiple different machines
In an ideal world I would just move the functionality I require to access via VBA into a another class, but my company has hundreds of spreadsheets that already use the old library and Im not keen to update the VBA code in all of them.