적용 대상
Microsoft 365용 Access Access 2024 Access 2021 Access 2019 Access 2016

적용 대상

응용 프로그램 개체

파일 대화 상자의 단일 인스턴스를 나타내는 FileDialog 개체를 반환합니다.

expression.FileDialog(dialogType)

필수 요소입니다. 적용 대상 목록에 있는 개체 중 하나를 반환하는 식입니다.

dialogType    필수 MsoFileDialogType입니다. 파일 대화 상자의 형식입니다.

MsoFileDialogType은 이러한 MsoFileDialogType 상수 중 하나일 수 있습니다.

msoFileDialogFilePicker

msoFileDialogFolderPicker

msoFileDialogOpen Microsoft Access에서 지원되지 않습니다.

msoFileDialogSaveAs Microsoft Access에서 지원되지 않습니다.

주의

msoFileDialogOpenmsoFileDialogSaveAs 상수는 Access에서 지원되지 않습니다.

이 예에서는 FileDialog 개체를 사용하여 사용자가 하나 이상의 파일을 선택할 수 있는 대화 상자를 표시하는 방법을 보여 줍니다. 그러면 선택한 파일이 FileList라는 목록 상자에 추가됩니다.

Private Sub cmdFileDialog_Click()
   ' Requires reference to Microsoft Office 11.0 Object Library.
   Dim fDialog As Office.FileDialog
   Dim varFile As Variant
   ' Clear listbox contents.
   Me.FileList.RowSource = ""
   ' Set up the File Dialog.
   Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
   With fDialog
      ' Allow user to make multiple selections in dialog box
      .AllowMultiSelect = True
      ' Set the title of the dialog box.
      .Title = "Please select one or more files"
      ' Clear out the current filters, and add our own.
      .Filters.Clear
      .Filters.Add "Access Databases", "*.ACCDB"
      .Filters.Add "Access Projects", "*.ADP"
      .Filters.Add "All Files", "*.*"
      ' Show the dialog box. If the .Show method returns True, the
      ' user picked at least one file. If the .Show method returns
      ' False, the user clicked Cancel.
      If .Show = True Then
         'Loop through each file selected and add it to our list box.
         For Each varFile In .SelectedItems
            Me.FileList.AddItem varFile
         Next
      Else
         MsgBox "You clicked Cancel in the file dialog box."
      End If
   End With
End Sub

도움이 더 필요하세요?

더 많은 옵션을 원하세요?

구독 혜택을 살펴보고, 교육 과정을 찾아보고, 디바이스를 보호하는 방법 등을 알아봅니다.