File open dialog in Outlook 2003

Hello

I need a dialog box for file selections. The problem is, that in outlook vba no dialog boxes exists to select files outside of outlook.

I need the same dialog box as in excel "GetOpenFileName" that users are able to select a file.

I have tried to do that with API functions. But I know only the API function SHBrowseForFolder. With that I can only select folders but not files.

Is any body here who know how to do that?

Thanks for your efforts.

[497 byte] By [FreakFrossard] at [2007-12-22]
# 1

You're right -- Outlook VBA doesn't support the FileDialog object. The easiest way around this (even though it's cheating), is to just spawn the FileDialog elsewhere. Code like this should work:

Dim xlApp as New Excel.Application
xlApp.Visible = False
With xlApp.FileDialog(msoFileOpen)
' your dialog init code goes here
End With
xlApp.Quit
Set xlApp = Nothing

It's not pretty, but it gets the job done

duckthing at 2007-8-30 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...