2011年5月23日月曜日

Excel VBA ファイル選択ダイアログ表示編

Public Function fileSelect(fpath As String)
    Set FS = CreateObject("Scripting.FileSystemObject")
    file = fpath
    With Application.FileDialog(msoFileDialogFilePicker)
        If fpath <> "" And FS.FileExists(fpath) Then
            .InitialFileName = FS.GetParentFolderName(fpath)
        End If
        If .Show = True Then
           file = .SelectedItems(1)
        End If
    End With
    fileSelect = file
End Function

0 件のコメント:

コメントを投稿