[dba-VB] Common Dialogue to Open Files-Search

MartyConnelly martyconnelly at shaw.ca
Fri Jul 29 14:40:02 CDT 2005

 API: Call the standard Windows File Open/Save dialog box 

Or you can use Application.FileDialog in Access XP and higher
and do multisect, open or save, however fails with runtimes.

Sub test()
'needs reference to MS Office Object library
' No go with Runtime
Dim dlgOpen As Object 'FileDialog

Set dlgOpen = Application.FileDialog(msoFileDialogOpen)

With dlgOpen
    .InitialFileName = "C:\"
End With
Dim strfile As String, fdObj As FileDialog
    Set fdObj = Application.FileDialog(msoFileDialogFilePicker)
    If fdObj.Show = -1 Then
        MsgBox fdObj.SelectedItems(1)
        MsgBox "You didn't select a file!"
    End If
    Set fdObj = Nothing
End Sub

Randall R Anthony wrote:

>Hi listers,
>Friday pm brain cramp, I can't seem to find the info for using the MS
>common dialogue control to create the M$ Office Open Files in an Access
>app I'm working on.  Any help would be appreciated.  I've used this
>before but can't find where I put it.  Thanks!
>dba-VB mailing list
>dba-VB at databaseadvisors.com

Marty Connelly
Victoria, B.C.

More information about the dba-VB mailing list