LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel manually minimized causes error

Has anyone had odd behavior happen when trying to write data to a Excel file while minimized? I ask because whenever I program LabVIEW to open Excel, open a template, save it as another name, manually minimize Excel (our company has upgraded to Excel 2016 from Excel 2010), and then try to write data to the file, I always get an unhandled error. It appears that whenever Excel is minimized, it seems to lose its reference and thus the error is generated.

 

Has anyone had this error before? I am running LabVIEW 2016 but I don't know what version of the Report Toolkit I have, or really, where to look for it. An example is below.

Download All
0 Kudos
Message 1 of 9
(4,316 Views)

Is the behaviour the same if Excel is not minimized? You should use Save Report To File only at the end because this vi do not update the Report object Workbook refnum to the new saved workbook, it still refer to the template. That may be the cause of the unhandled error.

 

Ben64

0 Kudos
Message 2 of 9
(4,294 Views)

Ben - it doesn't appear so. It writes fine, either by using normally (unwired) or maximized window states (either manually or having the window state set). I tried setting the state to minimized and I get the same error.

 

I feel like if the Save Report to VI doesn't update the refnum when minimized but does for the other states, then it's a bug. It states in the documentation as "a reference to the report whose appearance, data, and printing you want to control" which would mean that I should be able to use it. It even states that I can use this with Excel and Word reports.

 

Are you thinking something different?

0 Kudos
Message 3 of 9
(4,287 Views)

I remember about a similar problem and found this thread. The 3rd post from the end gives a possible solution.

 

Ben64

0 Kudos
Message 4 of 9
(4,280 Views)

That wasn't it but it gave me some time to dig into the issue. The issue, at least in my case, is the NI_Excel.lvclass:Excel Merge Cells.vi with the Range.Merge Invoke Node. It works under any state other than when Excel is minimized, then an error occurs.

 

I do have a workaround (don't minimize Excel) but I wonder if this as been brought to any NI Rep.

 

ExcelMergeCellsVI_BD.png

 

 

0 Kudos
Message 5 of 9
(4,247 Views)

The best way to find out if NI is aware of a potential bug is to file a bug report.  Otherwise, you're hoping someone from NI happens to see this specific thread, read all the way through it, and respond to provide that information.

Message 6 of 9
(4,230 Views)

This is most likely a Microsoft error. Try inserting the following code right after New Report.vi.

Set Display Alert to False.png

Ben64

 

0 Kudos
Message 7 of 9
(4,207 Views)

Ben,

That did not appear to work. I get the same error as before. I went ahead and took natasftw's advice and placed a bug report with NI. We'll see what that does.

 

Thanks for your help.

0 Kudos
Message 8 of 9
(4,190 Views)

Bug report is #680269.

0 Kudos
Message 9 of 9
(4,178 Views)