Error -2146827284 When Writing to Excel Report Using Report Generation Toolkit

Updated Jun 17, 2019

Reported In


  • LabVIEW Report Generation Toolkit
  • LabVIEW 2015
  • LabVIEW 2018

Issue Details

Scenario 1

I am developing a LabVIEW VI using the Report Generation Toolkit for Microsoft Office. I am creating an Excel document using the New and writing values to that report using the Excel Easy An example snippet of my code is shown in Figure 1 below:

Figure 1: Snippet to Reproduce 2146827284 Error
When I run my program my report is not written to and my error handler reports Error 2146827284 ("Error 2146827284 occurred at an unidentified location."). Figure 2 below displays the error when using a Simple Error What causes this error to occur and how do I prevent it from happening?
Figure 2: Error Reported by Report Generation Toolkit VIs

Scenario 2

In my application, I write several rows and columns to an Excel worksheet created from a template. This works well for a certain amount of rows and columns, but I eventually get this error when I increase the number of rows to be written. What should I do?


Scenario 1

This error is being thrown by an specific invoke method within Excel Easy The following fixes will prevent this error from being thrown. 
  1. Change the minimized enum constant connected to the New to maximized, no change, or normal (One example can be seen below in Figure 3.)
  2. Make sure you have the Microsoft Excel program fully opened before running your program.

Figure 3: Solution Snippet ("minimized" enum changed to "maximized")
If the above changes do not prevent this error from being thrown check the following criteria:
  • The error occurs after a specific length of execution time
  • You are using Microsoft Excel 2003 or earlier
If your program meets this criteria then this error is likely being thrown due to the pre-2007 Microsoft Excel spreadsheet size limit being reached. 

Scenario 2

Try writing fewer rows and/or columns with the application. Basically, reduce the amount of data that is being used until you don't get the error, or to a safe limit in which you are sure this does not happen. Then, you can use a while loop to write the data that has not been written with the previous iteration and so on.

Additional Information

Microsoft Excel spreadsheets were limited to 256 columns and 65,536 rows until its 2007 release which increased these limits to 16,384 columns and 1 million rows. If these limits are exceeded and there is an attempt to access a row or column outside the allowed range, this error will occur: Error -2146827284 from the Excel_Get_Range VI. Writing to an Excel spreadsheet inside a while loop can quickly exceed these limits if they are not checked. Report Generation Toolkit began supporting Office 2007 with version 1.1.2.

This issue can be related to memory usage, since testing in different LabVIEW and Excel versions give an error that mentions it is due to not enough memory for the operation.