AccessVBAでファイル参照ダイアログ表示(フォルダ選択)

CSVファイルを選択させるのにファイル選択ダイアログを表示するサンプル関数

参照設定「Microsoft Office *.* Object Library」チェック

Function selectCsvFileDialog(strTitle As String, selectType As Integer)
    Dim varSelectedFile As Variant
    Dim mType As Integer
    
    If selectType = 0 Then
	    'ファイルを選択
        mType = msoFileDialogFilePicker
    Else
	    'フォルダーを選択
        mType = msoFileDialogFolderPicker
    End If

    With Application.FileDialog(mType)
        'ファイルの種類をCSVへ
        If selectType = 0 Then
            .Filters.add "CSV ファイル", "*.csv"
        End If
        '複数ファイル選択不可
        .AllowMultiSelect = False
        '初期フォルダ
        .InitialFileName = CurrentProject.path
        'ウインドウタイトル
        .title = strTitle
        If .Show = -1 Then
			'ファイル選択結果
            For Each varSelectedFile In .SelectedItems
                selectCsvFileDialog = varSelectedFile
            Next
        End If
    End With
        
End Function

例)

csvFile = selectCsvFileDialog("CSVファイルを選択してください", 0)