Outlook: FileDialog object error

Am writing a small routine in Outlook 2010 vba. Intension routine is for users to select the location (folder) where they want to save selected messages. To do the job I I want to use the FileDialog object. The routine looks:


Public Sub ....
    Dim fdFolder As Office.FileDialog
    Set fdFolder = Application.FileDialog(msoFileDialogFolderPicker)
End Sub

I get an error on row: Set fdFolder .....

(Runtime error 438. Object doesn't support this property or method)


Reference to Office Object Library is ok.


What is wrong?


Here's a really awkward workaround, but it might give you an idea of how to do what you want.  Since Outlook doesn't seem to support the FileDialog object, use one of the other Office apps as a "surrogate".




'=========== BEGIN CODE ===========

Public Sub TestFileDialog()
    Dim otherObject As Excel.Application
    Dim fdFolder As office.FileDialog

    Set otherObject = New Excel.Application
    otherObject.Visible = False
    Set fdFolder = otherObject.Application.FileDialog(msoFileDialogFolderPicker)
    Debug.Print fdFolder.SelectedItems(1)
    Set otherObject = Nothing
End Sub

If this post is helpful or answers the question, please mark it so.

3 people were helped by this reply


Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.


Question Info

Last updated July 30, 2019 Views 6,798 Applies to: