Reputation: 3485
I have this code:
app = new Application();
app.Visible = false;
workbook = app.Workbooks.Add(1);
worksheet = (Worksheet)workbook.Sheets[1];
worksheet.Name = "TEST";
doSomethingInXLS();
app.GetSaveAsFilename("TEST", "Excel (*.xls), *.xls", 1, "Save TEST", Missing.Value);
If I put Visible = true then I can see the excell is being generated correctly, but when I call the method GetSaveAsFilename, the save dialog show me, but the file is not saved, Why?
Upvotes: 0
Views: 2147
Reputation: 700690
Because that's what the method does:
"Displays the standard Save As dialog box and gets a file name from the user without actually saving any files."
http://msdn.microsoft.com/en-us/library/aa195748%28v=office.11%29.aspx
To save the file you should get the filename that the method returns and use that to save the workbook.
Upvotes: 3