Can someone show me show to reference PLSynchronizationMgr.dll when installation folder can be either X, Y or Z? I would prefer late binding method instead. Some samples will be much appreciated. Thanks
@vincent.tan
The only time I expect to see this compile error due to missing VBA reference is if the file is opened in the session of Excel without Eikon Excel COM add-in loaded.When the spreadsheet is opened in Excel with Eikon Excel add-in loaded (whether signed in or not), VBA willrecognize that PLSynchronizationMgr.dll is already in-memory and won’t use thepath in the reference to access the library. In other words, as long as EikonExcel COM add-in is loaded into the session of Excel, the user should never seethe compile error due to missing VBA reference. If you need to deal with the case where the spreadsheet may be opened in Excel session without Eikon Excel COM add-in, theonly workaround I can suggest is to copy PLSynchronizationMgr.dll to a commonlocation where it can be referenced from in all VBA projects. This is solelyfor the purpose of providing COM class definitions and avoiding the compile error.For that reason I would also strongly suggest adding a bit of defensive codesurrounding the parts of code that access COM objects from PLSynchronizationMgr.dll.Specifically I suggest checking if Eikon Excel COM add-in is loaded into thesession of Excel before creating any objects provided by PLSynchronizationMgr.dll.E.g.
If Application.COMAddIns("PowerlinkCOMAddIn.COMAddIn").Connect Then Set objEikonSyncMgr = CreateReutersObject("PLSynchronizationMgr.SynchroMgr")Else MsgBox "Thomson Reuters Eikon Excel add-in is required for this file and is not loaded into this session of Excel. Please load Thomson Reuters Eikon Excel COM add-in and try again."End If
@vincent.tan, you can reference it once from your active folder (check out %PROGRAMFILES(X86)%\Thomson Reuters\Eikon\Eikon.exe.xml tag Eikon/BinFolder)
After that Excel will give you a version that is loaded with Eikon Excel itself.
I have reference it to my active folder which is X. When users open on their PC they get the following error because they only have Y and Z on their PC.
Thanks Alex. We have tried that and the compiling error remains. We load our components via command lines. The COMAddin is not loaded yet when the compilation take place in Excel. Hence adding the If Statement beforehand does not address the problem.
Hi @vincent.tanIn this case, as I said in my previous response, the only workaround I see it to copy PLSynchronizationMgr.dll to a common location where it can be referenced from in all VBA projects. This location can be a network drive accessible by all users or a common location on the local drive. Referencing PLSynchronizationMgr.dll from a common and static location will take care of the compile error. The defensive code sample I provided was not meant to address the compile error. It was meant to prevent the instantiation of objects provided by PLSynchronizationMgr.dll when Eikon Excel COM add-in is not loaded (yet), which would result in a run-time error.
Hi Alex and Zhenya, I have tried copying the dll into a shared folder on the network drive. Excel does not allow early binding on files sitting on the network drive. Hence this option will not work. Another possibility is to copy the dll files into their local machines. IT desktop support will need to be involved and does not self update to the new version when it becomes available. In the end I have decided not to use PLSynchronizationMgr.dll at all in any of my solutions.
Hi Vincent,Sorry to hear you decided not to use PLSynchronizationMgr.dll. On my end I have no problem copying this dll to a network drive and referencing it in a VBA project, which then compiles without Eikon Excel add-in. What was the error you saw when you tried to do this?The fact that the file on the network share will not be updated is of little significance. PLSynchronizationMgr.dll is in care and maintenance and no updates are expected. However, should there be an update, the file in Eikon install folder will be updated, and this is the file that is loaded into Excel and used at runtime. The file on the network share only provides class definitions used at compile time if Eikon Excel add-in is not loaded. And existing class definitions in a COM library cannot change even if the library is updated because this would break backwards compatibility. When a COM library is updated one can only add new classes, properties, methods and events. Definitions for existing properties, methods and events of existing classes cannot change.