Search code examples
vbams-officefiledialog

MS Office SaveAs type FileDialog with a filter in vb


I want to create a 'save as' file dialog with a filter, but this doesn't seem possible using the FileDialog class (Microsoft Office 12.0 Object Library). The documentation actually mentions this here, see last paragraph, but gives no reason as to why? Is there another way of achieving this in vb?

I find it strange that the FileDialog class doesn't allow this because Word, Excel and Access all have this exact SaveAs feature built-in.

I realise that the FileDialog can created as a FilePicker (msoFileDialogFilePicker) which does allow filters, but then this doesn't allow a file to be selected that doesn't yet exist, which defeats the whole point.


Solution

  • As @AlexK mentioned the only way to do this is using a windows API call. See here