styrum Posted June 10, 2016 Report Posted June 10, 2016 Now that it looks like Microsoft deprecated ActveX Automation interface in Excel 2016, the only other interface left is .NET interop assemblies. I have tried to reproduce Excel - Write Table.vi using .NET instead of ActiveX. The result of the effort is attached. There is a big problem though: The Range.value2 property could take 'anything' without a problem when using ActiveX (it was taking any variant)! But now it wants a .NET object. And the 'To .NET Object.vi' doesn't accept a 2D array of variants! So, say getting a recordset from a database (which is returned as a 2d array of variants) and then writing it, as it is, to a new Excel workbook is no longer possible as far as I understand. This is really sad. A 2D Table of strings or doubles is still OK. So, if you need to use those, you can with the attached code Write Table to Excel with DotNET.vi Quote
Neil Pate Posted June 10, 2016 Report Posted June 10, 2016 Strange, I have Excel 2016 and my Report Generation Toolkit code still works just fine, with its usual ActiveX implementation underneath. Quote
styrum Posted June 10, 2016 Author Report Posted June 10, 2016 Did you try that 'Excel - write table.vi' example shipped with LabVIEW? Maybe there are some options during installation of Excel/Office or after it to install/turn on or not install/turn off ActiveX support? Quote
styrum Posted June 10, 2016 Author Report Posted June 10, 2016 (edited) Any idea how to write a 2D array of variants as a whole into Excel sheet using .NET calls? Doing it one cell at a time is apparently not feasible for large recordsets. Edited June 10, 2016 by styrum Quote
styrum Posted June 10, 2016 Author Report Posted June 10, 2016 OK, so ActiveX still works in Excel 2016. But it is older than .NET and they can still deprecate it in the next version. So, experience on how to communicate with Excel via .NET can become very valuable. Quote
Neil Pate Posted June 11, 2016 Report Posted June 11, 2016 Sorry no, I have not tried the .NET interface. I suspect MS will have lots of angry customers if they truly decide to remove (rather than just deprecate) the ActiveX interface. I am going to leave it to NI to solve that problem if it arises, Quote
Rolf Kalbermatter Posted June 13, 2016 Report Posted June 13, 2016 (edited) On 10-6-2016 at 11:26 PM, styrum said: OK, so ActiveX still works in Excel 2016. But it is older than .NET and they can still deprecate it in the next version. So, experience on how to communicate with Excel via .NET can become very valuable. While ActiveX is already a legacy technology according to MS, they won't just chop it off like that from any of their products without a really strong reason. Depreciation will happen eventually, first by prominent remarks in the documentation, then by removing the documentation slowly from all Microsoft servers but removing it from the applications itself? No way! Windows still supports many technologies from its 16 bit protected mode times, such as DDE, just to name one and while MS says: Don't use it! it's still part of the shell interface to all normal Windows applications. Edited June 13, 2016 by rolfk Quote
ShaunR Posted June 13, 2016 Report Posted June 13, 2016 21 minutes ago, rolfk said: Windows still supports many technologies from its 16 bit protected mode times, such as DDE, just to name one and while MS says: Don't use it! it's still part of the shell interface to all normal Windows applications. Or as Linus Tovalds says: "Never break user space" and "if you change the ABI, I will crush you!" . (Shame they don't listen to him ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.