LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel OLE Error when accessing Excel through LabVIEW

Hi All

 

I have an application wherein I am searching through large number of excel files names (in hundreds) . If the excel file name matches with Pattern provided, I am opening the excel , reading few columns from it and then closing the excel. The pattern which I am providing to look into excel file has upto 1500 permutations.

So in short , I am taking each pattern at one time , checking its availability in hundreds of excel file names and if it is present , I am opening excel, reading stuff and then closing excel.

This works good for some time , however After some time , when my LV application is running I am getting below error popup :

"Microsoft Excel is waiting for another application to complete an OLE action." This popup continues to come at very fast rate and remains there even if I exit LabVIEW.

 

If I am opening normal Excel file(and not through LaBVIEW) this issue is not observed.

I am attaching VI over here which I am using for reading excel.

0 Kudos
Message 1 of 5
(2,626 Views)

The only thing that stands out to me in this VI is that you do nothing if you encounter an error.  You leave references open and you don't close Excel. If this happens repeatedly, you'll end up with many instances of Excel running in the background. 

 

How is this subVI called?  Can you post the parent VI?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 5
(2,592 Views)

I am leaning toward what aputman wrote and going a bit further...

 

I think you would be better off opening Excel ONCE before you start looking at the files and pass for Excel into your sub-VI. This should eliminate the need to repeatedly open and close Excel

 

Then inside your sub-VI, make sure you close any file that was opened regardless of errors etc.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(2,583 Views)

Thank you for reply.

As suggested , VI is now modified to close references when any error is encountered . Still ending up with same error over a period of time.

 

As suggested by ben, what i understood is i need to open excel application ref once (before for loop), then have this subvI inside for loop(which is how it is called currently to go through each excel file name) and then when all the pattern is matched , exit for loop and close the application ref for excel.

 

I will check if this works out.

0 Kudos
Message 4 of 5
(2,568 Views)

Can you post your modified code?

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 5
(2,563 Views)