LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 6 occurred at Open/Create/Replace File in NI_Excel.lvclass:Save Report to

Solved!
Go to solution
I have an application that works on LV60 and when run in LV86 I get the following error: Error 6 occurred at Open/Create/Replace File in NI_Excel.lvclass:Save Report to File.vi->SWF001 Test.vi Possible reason(s): LabVIEW: Generic file I/O error. ========================= NI-488: I/O operation aborted. C:\SWF001 IO Files\1_Single.xls The application does: New Report.vi Excel Get Worksheet.vi Excel Easy Table.vi Excel Easy Text.vi (4 of them) Save Report to File.vi Dispose Report.vi all in a nice chain (errors and report-in/outs) as is typical For some reason I'm getting this error. I'm using it with Excel 2003 SP3 and the spreadsheet contains macros (and I get a prompt "should I enable macros:" (I answer yes), that I didn't get with LV60 and the older version of Excel). This is probably not the problem? but deserves mention. The file does exist on the system (and it appears the application is writing to it successfully - though perhaps truncated as the error indicates- i can't tell for sure). I can open and save the Excel file independently of LV just fine. Any clues? Many thanks! -David
0 Kudos
Message 1 of 13
(6,494 Views)
Try setting your Security for Macros in Excel to Low.  That should eliminate the dialog box asking if you want to enable macros, and also tell you if that is what is tripping up the file open function within LabVIEW.
Message 2 of 13
(6,484 Views)

Unfortunately, an Error 6 is a catch all category for all sorts of file IO errors that LV doesn't know how to handle. For example, while it doesn't sound like your problem, trying to access a file that resides on a network drive that isn't currently mounted can generate an Error 6.

 

Have you tried saving the file to a different location?

If you restart your computer and run the VI does it generate the error the very first time you run it?

Can you post your code - or at least a subset of it that demonstrates the problem?

Is Excel open when you are running the code?

 

Also, as a test try modifying your code so it has a unique name every time you save it.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 13
(6,482 Views)
I tried: Creating an empty "input" .xls file in a newly created directory and hardcoded to use that - no help. Setting security to low so the prompt does not occur - no help. Is Excel open when you are running the code? - no Also, as a test try modifying your code so it has a unique name every time you save it. - THATS IT! So why do I have to save it with a different filename???
Message 4 of 13
(6,462 Views)

My guess is that the ActiveX code is not closing the file or shutting down Excel when it finishes. If you don't explicitly stop it Excel will continue running in the background which can cause all manner of weirdities.

 

Something you might want to consider is changing the way you are access the spreadsheet file. You can also read/write xls files using ADO.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 13
(6,451 Views)
I'd like to see someone from NI research this further and possibly file a defect report. It worked fine in LV 6.0 with an older version? of Excel.
0 Kudos
Message 6 of 13
(6,447 Views)

That is very likely, but Microsoft has rewritten the Excel interface at least twice since V6 was current - which is why I like to avoid the whole issue and use ADO to interact with Excel files. It's even faster...

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 7 of 13
(6,445 Views)

Hi Deppangtc,

 

You have an interesting problem. I would like to see some files so that I can replicate your problem here. Which version of LabVIEW and OS are you using? Have you noticed this in previous versions? Or with any other versions? Were you able to get this working properly in older versions?

 

Mike,

Thank you for your solution and suggestions on this one!

 

 

Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 8 of 13
(6,432 Views)
Hi Karunya, Thanks for your help. See above for LV & Excel rev. It's on Windows XP. No other versions besides those mentioned were tested.
0 Kudos
Message 9 of 13
(6,406 Views)

HI Deppantgc,

 

I requested your files because that would make the problem replication smoother. In situation like these, there are few triggers and circumstances that cause the error message to happen. In order to replicate the problem, it is, often, best to start with the file that causes the issue. This way, I can use your files, replicate the problem and test it out on different systems. If you can post what exactly your application does and the files themselves, it would be easy for me to file a report/research this further.

 

Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 10 of 13
(6,378 Views)