I have a Windows Forms app with an Excel file I created using SpreadsheetGear. My application uses SaveFileDialog()
to prompt the user to save the file to their computer using the following code:
'Bring up the save dialog to save the newly created Excel file
Using saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.FileName = "ExportFile.xlsx"
If DialogResult.OK <> saveFileDialog1.ShowDialog() Then
Return
End If
Try
e.Result.SaveAs(saveFileDialog1.FileName, FileFormat.OpenXMLWorkbook)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message, "Save Error", MessageBoxButtons.OK)
End Try
End Using
That code works fine but the user doesn't want to worry about saving the file. He just wants it to open right away so he can copy/paste the information he needs and then discard the file without having to navigate to his save destination. I can't seem to get SaveFileDialog()
to do that for me.
Is there a better way to do this?