• July 17, 2017
    Announcement: New site design for Microsoft Community

    In July, Microsoft will roll out the first of ongoing site improvements aimed to modernize Microsoft Community and help customers get the most out of their community experience.

    • During the roll out period, you may see the old or new site design depending on your location

    • We expect the roll out to finish by 31 July

    Note: Past private message conversations will not move to the new site design. Please save any private messages you would like to keep.

     Learn more about the upcoming site improvements in this thread.

    Thank you for being part of Microsoft Community!

 
Question
5498 views

Outlook: FileDialog object error

M_K_M asked on

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?

6 people had this question

Abuse history


The answered status icon Answer
E.J. GUN replied on

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".

HTH,

Eric

 

'=========== 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)
    fdFolder.Show
    Debug.Print fdFolder.SelectedItems(1)
    otherObject.Quit
    Set otherObject = Nothing
End Sub

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

Abuse history


progress