After processing, my application automatically opens an Excel file. When you open an Excel file, the Save As dialogue box must also be opened. Is it possible ?
using Excel = Microsoft.Office.Interop.Excel;
Save AS Dialoge box calling.
After processing, my application automatically opens an Excel file. When you open an Excel file, the Save As dialogue box must also be opened. Is it possible ?
using Excel = Microsoft.Office.Interop.Excel;
Save AS Dialoge box calling.
You can use Excel's the Application.FileDialog property (method in C#) to get the required dialog and then display to a user, for example, the following VBA sample shows how to do that:
Sub SaveWorkbook()
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
sPath = .SelectedItems(1)
ThisWorkbook.SaveAs Filename:=sPath & Application.PathSeparator & "Copy of " & ThisWorkbook.Name
Cancel = True
End If
End With
End Sub
Also you may consider using the .net base class libraries that provide the built-in class for that:
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
saveFileDialog1.FilterIndex = 2 ;
saveFileDialog1.RestoreDirectory = true ;
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string path = saveFileDialog1.FileName;
}
See SaveFileDialog for more information.