10-20-2014 08:22 AM
Written using LV2014 64bit, this WriteExcelChart.zip VIs on the forum thread do the following:
"OpenMSExcel" - open Excel then adds an unused sheet.
"WriteExcel" - takes a 2D array (or 1D), creates a new sheet if the name does not exist or to named sheet, writes the data to Excel sheet.
"'WriteExcelChart" - same as above but adds option to plot the Excel data using your chart type. Both WriteExcel VIs are reentrant this way your able to run seperate code modules that continue writing where the last write line ended. This VI will have some code I stripped out, modify as needed.
"ExcelRefsGetSet" - action engine caches references, no need to wire Excel VIs in your code.
"CloseExcelRef" - must use to close Excel reentrants refs when done.
Rich J
06-09-2016 11:24 PM
Now that it looks like Microsoft deprecated ActveX Automation interface in Excel 2016, the only other interface left is through .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 'To .NET Object.vi' doesn't accept a 2D array of variants which the Range.value2 property when using ActiveX could without a problem! So, say getting a recordset from a database 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 OK. So, if you need to use those, you can with the attached code
06-10-2016 02:45 PM
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-10-2016 04:35 PM
So what? LAVA is LAVA, NI Forums have not exactly the same audience. Otherwise why would both need to exist?
06-10-2016 04:36 PM
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.
06-10-2016 05:40 PM
@styrum wrote:So what? LAVA is LAVA, NI Forums have not exactly the same audience. Otherwise why would both need to exist?
There are many of us on both LAVA and the NI Forums. Besides, the crossposting is just showing people another place where the discussion is happening, hopefully adding value in both locations.
06-10-2016 05:53 PM
Oh, sorry. I thought you were objecting crossposting. But you just pointed to where else it is discussed.
06-13-2016 08:41 AM
@styrum wrote:Oh, sorry. I thought you were objecting crossposting. But you just pointed to where else it is discussed.
Yup, not criticizing, just trying to help those taking place in the conversation, the similar discussion taking place elsewhere.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-25-2017 12:04 PM
Like many others, I was looking for a "simple" way to get spreadsheet data from an Excel doc into LabVIEW. This board was very helpful in getting me started. Unfortunately, every time I thought I had a stable solution, a new problem would crop up. Issues such as:
How to get all the contents of the sheet.
How to change workbook pages.
What if Excel is already open. Closing it programatically would appear strange to the enduser.
What if Excel has the target spreadsheet already open. Once again, closing it might be bad.
An error can lead to an open hidden instance of Excel.
I've attached my sub-VI which takes from many other examples to create a single sub-VI solution. I'm an absolute ActiveX novice, so hopefully I've got it right!
This example will check to see if Excel is already open and not close it if it is. It will also check to see if the target workbook is already open and not close it if it is; but close it if it is not. Also, in the event of an error, this VI will kill the Excel task to prevent a hidden background instance of Excel.
...Mike
06-08-2017 04:05 PM
This is the same Excel Read.vi, but saved in LabVIEW 2013. In my previous post, it was saved in 2014.