LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing an excel sheet using active X%3F

Solved!
Go to solution

I am working with report generation toolkit.

Before generating the report I'm trying to close all the excel sheets using Active X. At times the excel application gets closed without asking for the save or dont save option.

What change should I do in the code?

Please find the attached code

0 Kudos
Message 1 of 5
(3,044 Views)
Solution
Accepted by topic author Hridhyaa

If you are working with the Report Generation Toolkit, are using a fairly recent version of LabVIEW (say 2010 or later), and have opened an Excel Report, you should not be using ActiveX to close it (you should try to not use ActiveX for anything unless there is no alternative).  Instead, use the Save Report and Dispose Report functions.

 

There is, however, an interesting bug in Dispose Report -- if you "manually" close the Excel spreadsheet and stop Excel before LabVIEW does its Dispose, LabVIEW will actually "dispose" of your saved report!  Here's one place where I use ActiveX to guard against this bug -- I check that Excel is still running before I use Dispose Report.

 

BS

0 Kudos
Message 2 of 5
(3,008 Views)

I think you need th set the DisplayAlerts property to TRUE.

0 Kudos
Message 3 of 5
(2,996 Views)

Hi,

 

 

 

     Thanks for the help.

 

The VI is still not consistent at times. It closes without saving even if I'm using display alerts. I'm also getting an error when i keep running the code. And I think the error is because the excel sheet is maximised and I'm running the code. Please find the attached snapshot of the error.

 

 

 

Regards

 

Hridhya

 

0 Kudos
Message 4 of 5
(2,979 Views)

Check this Snippet.

 

Excel Close.png

 

Good reference

http://support.microsoft.com/kb/129153

Munna
0 Kudos
Message 5 of 5
(2,959 Views)