Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

ファイル選択ダイアログを表示

Private Function showFileDialog(ByVal title As String) As String
    
    Dim selectedFileName As String
    selectedFileName = ""

    With Application.FileDialog(msoFileDialogOpen)
        .title = title
        .AllowMultiSelect = False
        .InitialFileName = ThisWorkbook.path
        If .Show = -1 Then
            selectedFileName = .SelectedItems(1)
        End If
    End With
    
    showFileDialog = selectedFileName
    
End Function