LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2147417851 when writing report to Excel

I have taken the Active-X example code where a table is written to Excel and a macro is run and adjusted it to fit my purposes. In my case, an array is written to an Excel file and thereafter a macro is run which creates some graphs and a report. This works fine on my computer with Windows 95. But, when running it on the computer it is supposed to be used on, Excel gives an access error 0xc0000005 just before a copy operation resulting in the "error -2147417851 ocurred at the server through an exception at my.vi". I am using LabVIEW full development 6.1, Windows NT 4 with the latest SP and Office 97 SP2 both wit and without all upgrades. However, if I change my macro so that it doesn't do the copy operation, it works just fi
ne, and the error is delayed until I close the document. Since my LabVIEW vi ends when the macro is completed, I don't get any error in LabVIEW.

I have searched Microsoft technet and tried the suggestions I found there, read all similar problems I could find here (I found four) but nothing seems to help. I have also tried it on a machine with XP and Office 97 SP2. The macro works fine there without modification and LabVIEW ends without error and I can even close my Excel document without errors, but when I try to quit Excel I get the same error message as always, only a different address.

I have tried to terminate the refnums in different order, inserted a delay and so on, but nothing seems to help. I still believe the error is related to LabVIEW, since my macro runs without error when launched from Excel, but I encounter the same error if the macro is launched from Excel with LabVIEW open in the background, even without open vi:s.

I have run out of ideas, and even if I am abl
e to create the reports, it doesn't feel good when Excel crashes every time. Any help would be much appreciated.

Thanks
0 Kudos
Message 1 of 3
(3,459 Views)
Hi Paol,

Try looking at this answer posted a while ago it may help.

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RNAME=ViewQuestion&HOID=506500000008000000192E0000&ECategory=LabVIEW.LabVIEW+General
0 Kudos
Message 2 of 3
(3,459 Views)
Thanks, but I have already tried that and it did no difference. Excel crashes even if I don't call the macro fom LabVIEW but runs it from Excel, as long as LabVIEW is running, even if its not doing anything.
0 Kudos
Message 3 of 3
(3,459 Views)