LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Application busy error when reading an Excel spreadsheet

Solved!
Go to solution

Hi,

 

I get the below error when a VI tries to count the number of used rows in the used range of an Excel file.

 

Code: -2147417846

Error message:

The message filter indicated that the application is busy.
in Get Excel Columns.vi->Test Cases from Excel.vi

 

The error is not consistent and it occurs intermittently. The error occurs in the "Get Excel Columns.vi" where it uses the property node to count the number of used rows in the used range of an Excel spreadsheet. I have attached the VIs for reference.

 

I searched NI forum for similar issues but what I found did not help me with my issue. Kindly help solve this problem. 

 

Thanks.

0 Kudos
Message 1 of 7
(2,676 Views)
Solution
Accepted by topic author Such06

If you want to "count the number of used rows" on a WorkSheet, I recommend that you use the Excel Get Last Row.vi function.  Try using that and see if it avoids the error.  I've used it successfully for years without any problems.

 

Bob Schor

Message 2 of 7
(2,598 Views)

Thanks for the reply. I used Get Excel Last Row.vi.

But, I get another error (-2146827284) with no explanation. The error occurs in Excel_Calc_Bottom_RowNum.vi (NI_ReportGenerationToolkit.lvlib) at the "Shape" property node which is used to get reference to the bottom right cell of a shape in the the worksheet (see screenshot). I use some buttons for macros in the excel file that I read and that is why it enters that part of the case structure. I have attached an example spreadsheet, screenshot of where the error occurs and the modified VI. 

I could just ignore this error and I am still able to get the value of the last used row without the "Application busy" error. But, I just wanted to see if I could know the exact reason for this error.

Thanks for your help.

0 Kudos
Message 3 of 7
(2,577 Views)

Of course, I couldn't test the code fragment you sent me without modifying it.  I deleted "Report In" and replaced it with Create Report, to which I wired the Excel file you attached (thank you for that).  It ran without error, giving me Start = 0, 0, End = 8, 27, and Address = $AL$3.

 

The very first time I ran it, I think I got the error you noticed, but that was because I had your Workbook opened in Excel, as I was curious to see what was in it.  When I closed Excel and ran a second time, there was no error.

 

If you are still having an Error, it may be coming through errors in the VIs that you failed to attach.  Next time, compress the Folder containing the entire LabVIEW Project and attach the resulting .zip file, along with an Excel data file.  Just in case we cannot reproduce your Error, it might be helpful to include a screen shot of the Error Message.

 

Bob Schor

0 Kudos
Message 4 of 7
(2,564 Views)

I have attached three VIs. The Test Cases from Excel.vi calls the other two VIs. You can select the spreadsheet path in Test Cases from Excel.vi (I have attached the workbook as well). 

 

I modified the Get Excel Columns.vi in the same way as you did i.e. use Create Report to open the workbook and the VI ran without any errors for me as well.

After some more trials using all three VIs, I noticed in the Test Cases from Excel.vi, when the window state option in Create Report is minimized, the error occurs (shown in screenshot) in Excel_Calc_Bottom_RowNum.vi (NI_ReportGenerationToolkit.lvlib). When the window state is left to default value, then the error does not occur.  I don't know what is the reason behind this, but it seems to solve the issue.

0 Kudos
Message 5 of 7
(2,538 Views)
Solution
Accepted by topic author Such06

From what I see from the diagram of your Get Excel Columns.vi the Excel busy error probably occurs because you are splitting the UsedRange reference to perform parallel tasks on these reference of the same object. Try serializing these tasks, first get the rows count and then pass the UsedRange reference at the output of the Range.Count property to the reference input of the Range.Find method.

 

Ben64

Message 6 of 7
(2,526 Views)

Solutions given by both Bob Schor and Ben64 worked. So, I have marked both as solutions.

Thanks.

0 Kudos
Message 7 of 7
(2,497 Views)