LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Excel Workbook Close won't save

Solved!
Go to solution

I am using ActiveX with Excel and trying to save and close a workbook, but not close the application.

My question is two fold:

 

First, I can't get a workbook to close when save is wired up to it and set as True. But, when save is set to False, the workbook closes fine (except it doesn't save obviously). I figured this could be related to the following sentence from MSDN

 

If there are changes to the workbook and the workbook appears in other open windows, this argument is ignored.

 

To verify this is not the case, I closed completely out of Excel and tried again. Still the same issue. 

 

So, my next step was to try a workaround like using the saveas method, then I can close the workbook without saving after this (i.e. false constant wired up).

 

From MSDN: xlLocalSessionChanges = 2       The local user's changes are always accepted.

 

But, when I wire "2" to the conflict resolution variant for the saveas method, I still get a dialog popping up asking the user if it's ok to overwrite the file. 

 

Has anyone run into this before? I have pasted useful links to MSDN below.

 

http://msdn.microsoft.com/en-us/library/bb241584(v=office.12).aspx

http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.close(v=vs.80).aspx

http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.saveas(v=vs.80).aspx

 

     

 

 

 

0 Kudos
Message 1 of 2
(3,582 Views)
Solution
Accepted by topic author GregFreeman

Workbook was corrupt. Solution was to recreate.

0 Kudos
Message 2 of 2
(3,515 Views)