LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intermittent Error 41106 Error when trying to open an Excel file.

I am having an intermittent problem while opening an Excel file.  The problem only occurs occasionally during execution of my program.  My program has a cluster of buttons each button opens a sub VI that is part of a calibration process.  The first VI generates an EXCEL filename that is used to save all calibration data.  A template is opened, data is placed in this template, and then it is saved under the generated filename.  Most of the time this seems to work fine, but every once in a while I receive a -41106 error indicating that Microsoft EXCEL did not open.  As far as I can tell when I run each sub VI independently they work fine and no errors are generated.  Does anyone know why this might be happening?  I would appreciate any help.
 
Thanks 
0 Kudos
Message 1 of 3
(3,968 Views)

What version of LabVIEW and the Report Generation Toolkit are you using?  I remember adding some code in the 1.1 version of the toolkit to attempt to avoid some Microsoft Excel latencies with opening/closing the application repeatedly, but it was by no means fool proof, since Excel sometimes takes its sweet time leaving memory when the application exits.  Without knowing any more specifics, my best suggestion is for you to add a small delay between successive operations regarding opening/closing Excel and see if that helps.  Also, if you could post a simple VI that demonstrates the behavior, that would be extra helpful.

Oh yeah, and another suggestion would be to open one report reference at the beginning of your program, and use this reference through the whole thing...I understand that this might not be possible, though, if you're opening different worksheets throughout the course of your application running.

Good luck,
-D

P.S. - For those of you reading this wondering why I would automatically assume MegaMan is using the Report Generation Toolkit, he cites error -41106, which is an error specific to this toolkit.

Message 2 of 3
(3,963 Views)

Thank you very much for your suggestion.  I added a 100 millisecond wait to each VI I created that accesses the worksheets.  I ran the program and it works very nicely. 

Thanks again for your help.

0 Kudos
Message 3 of 3
(3,954 Views)