Jump to content

Write table to Excel using .NET


Recommended Posts

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

Link to comment
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 by rolfk
Link to comment
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!" :D . (Shame they don't listen to him :frusty: )

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.