-1

如何使用 VBA 从硬盘打开 csv 文件而不给出文件的具体位置。

4

1 回答 1

0
Sub GetCSV()

    Dim sFile As String
    Dim wb As Workbook

    'You can get fancier with the "filter" argument, see the internet for more info
    sFile = Application.GetOpenFilename("*.csv,*.csv")

    'False means they clicked cancel
    If sFile <> "False" Then
        Set wb = Workbooks.Open(sFile)
        'do stuff
        wb.Close
    End If

End Sub
于 2012-07-26T21:46:10.973 回答