Thanks for your response. In answer to your questions...
This is office 2007 on a variety of OS's using VS2010 to build an application level addin.
To reproduce, create a new project in vs2010 using the template: Office / 2007 / Excel 2007 Add-in
Use the default target Framework of .net 4 or the .net 4 client profile.
Replace the contents of ThisAddin.cs with the code at the end of this post.
Run the addin by pressing F5 or however you like to do it.
You have a blank workbook.
Press ctrl-s to save it. The save as dialog appears, and you see that the diagnostic message indicates that the saveAs parameter is True, which is what you would expect it to be. Save the file someplace.
Modify a cell in the workbook. Then press ctrl-s again. Now, the document is saved with no save as dialog appearing, as you'd expect. However, note that the diagnostic message indicates that the saveAs parameter is True. We expect false in this
case, since no saveAs dialog is shown.
Repeat as often as you like, using Ctrl-S, the Save button in the QAT, and the Save button in the Application menu, always the same result - no dialog but diagnostic message say saveAs is True.
Now change the project to target .net 3.5 (don't forget to do build/clean first!) and repeat the steps above. Now, the behavior of the diagnostic message is as you would expect - true the first time when the save as dialog is shown, false thereafter (unless
of course you actually do a save as to a new file)
Not shown, but also true, is the behavior when the save operation is initiated from code, using the Workbook.Save method. The parameter is always True, even when saving with no saveAs UI showing.
Hope that clarifies. Sample addin code follows...
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
public partial class ThisAddIn
private void ThisAddIn_Startup(object sender, System.EventArgs e)
Application.WorkbookBeforeSave += Application_WorkbookBeforeSave;
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
private void Application_WorkbookBeforeSave(Excel.Workbook workbook, bool saveAs, ref bool cancel)
Trace.WriteLine("Application_WorkbookBeforeSave saveAs = " + saveAs);
#region VSTO generated code
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
private void InternalStartup()
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);