LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't open excel file after saving and closing excel with activex

I'm using activex to write and save excel files in LabVIEW. My application opens excel (not visible)writes a file, saves it, and then closes both the file and excel. When I try to open the file Excel opens but the file is not displayed, I see the excel header and footer but the file itself does not display. My application is still running at this point. Any suggestions?
0 Kudos
Message 1 of 2
(3,474 Views)
It is critical when using ActiveX with Excel that ALL refnums be properly closed when they are no longer used. Just a single refnum left open will cause the exact situation that you describe. Typically, but not required, the refnums will be closed in the reverse order in which they were created. Here is a good sequence:

Open Application ref
Property Workbooks ref
Open Workbook ref
Close Workbooks ref
Select Sheet ref
Select Range ref
Write Value2 to Range
Close Range ref
Close Sheet ref
Save Workbook
Close Workbook ref
Close Application ref

When you have properly closed all refnums, the problem will disappear.

Michael Munroe
Certified LabVIEW Developer
www.abcdef.biz
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 2 of 2
(3,474 Views)