I need to create a dotNet saveAs dialog, but I need to populate the file formats in the dialog. After the person have selected a file, it must connect that to a file format that I populate into the SaveAs command in the Excel Interop. After the Interop SaveAs command, I must check if the file have been saved correctly.
Do anyone have any experience in doing it?
I tried FileDialogFilters, but they don’t return the FileFormat.
The easiest way (and controlled way) is to detect the version of Excel (
Val(Application.Version)) and manualy link the extension to the XLFileFormats.This link gives a very complete example:
http://www.rondebruin.nl/saveas.htm
That way you can control which formats you want the user to save as, while making sure that format is supported by the user’s version of Excel.
To disable the double warning of overwrite and compatibility warning:
By looking at
workbook.Savedcan you determine of the file was successfully saved.