LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel error -2146777998

Hi LabView community,

 

I wonder is someone has encountered this problem before me. I am maintaining an application which generates 2 excel reports which are similar. The app generates them in a case structure wired to the loop value (i) of a for loop. (1st report in case 0, 2nd report in case 1)

 

All is good and works well on a development system, and 2 other PCs but on one particular customer PC, the above excel error occurs sometime between finishing the 1st report and starting the 2nd.

 

Meagre Google links point to problems not closing Excel after the 1st report - which is fine, but in my code there is only 1 reference to the report which is passed through each invoke node until there's a "Dispose Report.vi" at the end.

I also dont understand why, if excel being open causes this error, the error doesnt occur on the other 2 test PCs (all PCs are Windows 7-64/ Office 2010).

If Excel is opened again in parallel thanks to the marvels of auto parallism, this also confuses me because at the end of the 1st report there is a small delay inside a flat sequence so this would seem to restrict auto parallelism by using rules of dataflow , as well as the for loop generating the report mentioned earlier.

 

If I swap around the order of report generation, the failure still occurs between report 1 & 2.

 

Any ideas , world?

System is LabView 2011

 

Thanks,

Chris

0 Kudos
Message 1 of 7
(7,837 Views)

Which version of MS office do you use in the PC where you are facing this issue? Is it the same as the version in the development one (Where you don't have any issue)?. Please clarify

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 7
(7,830 Views)

Hi,

 

my development PC is Win 7-64 / Office 2010 , as is the 2 machines that run this application OK. The machine that throws the error no -2146777998 is also Win 7 - 64 / Office 2010.

 

My Employer's IT department believes in 'standard' builds, so whenever a new PC is bought , it gets wiped and the 'build' goes on it - makes for a pretty homogenous environment 🙂

 

I hope that helps - (probably not is my guess - were you thinking of differences in Active X / Object models between Excel versions?).

 

What do forum users think of my statements about dataflow rules restricting LabView from opening the 2nd iteration of the for loop before the 1st is finished. Is that assured?

 

Cheers,

Chris

0 Kudos
Message 3 of 7
(7,814 Views)

Hi El_Penguino,

 

Have you tried closing the reference in between reports? I know this would increase the overhead of your application, but it may be the case that Excel and/or ActiveX doesn't like being talked to twice with the same reference. I agree with your statement about forcing sequential running, but without context of your full code, I'm not sure.

David S.
0 Kudos
Message 4 of 7
(7,776 Views)

Hi David,

thanks for your reply. After generating each report, the VI finishes with a "Dispose Report". Is that enough to close the reference? The green reference line does not come out of Dispose Rport, so that's closed to isnt it?

 

Cheers,

Chris

0 Kudos
Message 5 of 7
(7,767 Views)

Hi El_Penguino,


The Dispose Report does close the reference to the report, however in my research it seems that Excel occasionally stays open behind the scenes, which may be what's causing the error. After you receive the error, open up Task Manager and see if there's an Excel process still running when Excel is not open. If so, stop the process, and attempt running your program again.

 

Here's the discussion I found that mentions the background Excel process messing with the Report Generation Toolkit:

 

Error -2146777998 Unkown System

http://forums.ni.com/t5/LabVIEW/Error-2146777998-Unkown-System/m-p/720393/highlight/true#M329651

 

I hope this helps!

 

David S.
0 Kudos
Message 6 of 7
(7,741 Views)

There didnt seem to be any logic to this error - the app worked ok on several machines but not another. Adding time delays to allow Excel to close didn't help ( maybe I should have tried longer....). I messed around for a while and then tried this loop which is a "do until no error" kind of approach. This now runs on my troublesome machine and the other machines too.

 

Time to move on to something more productive 🙂

 

Thanks everyone,

Chris

0 Kudos
Message 7 of 7
(7,717 Views)