LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding confirm dialog while saving an Excel file

I am writing an application that exports data to an Excel sheet by means of excel2000 instrument.I want to be able to suppress confirmation dialog box while saving a file over an existing one. The background is that the filename is choosen by the operator with FileSelectPopupEx, so if the file already exists the function automatically asks for a confirmation before exiting so an additional same dialog is annoying.

 

Based on this MSDN page, I experimented with ConflictResolution parameter in Excel_WorkbookSaveAs to no avail: the line I am using is this one but it keeps prompting me a confirmation dialog if the file already exists:

	errChk (Excel_WorkbookSaveAs (ExcelWorkbookHandle, NULL, MyVariant, CA_DEFAULT_VAL,
				CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL,
				ExcelConst_xlNoChange, CA_VariantInt (ExcelConst_xlLocalSessionChanges),
				CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL));

Based on this post by kirkm I found that calling

	errChk (Excel_SetProperty (ExcelAppHandle, NULL, Excel_AppDisplayAlerts, CAVT_BOOL, VFALSE));

I can suppress the dialog, but it suppresses all alerts that could be raised and it seems excessive to me. I wonder if anyone succeeded in hiding the dialog in Save As call.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 5
(4,850 Views)

Well, the solution proposed there is simply to hide alerts before saving, so no way to have the parameter of Excel_WorkbookSaveAs working as it is supposed (?) to do. Hiding the alerts prevents messages despite the content of ConflictResolution parameter.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 5
(4,803 Views)

@RobertoBozzolo wrote:

Well, the solution proposed there is simply to hide alerts before saving, so no way to have the parameter of Excel_WorkbookSaveAs working as it is supposed (?) to do. Hiding the alerts prevents messages despite the content of ConflictResolution parameter.


Did you try it ?

0 Kudos
Message 4 of 5
(4,789 Views)

Of course I did!



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(4,785 Views)