从CSV文件转换为Excel的多个Sheet

Sub Macro3()
    Application.ScreenUpdating = False
    Set oConn = CreateObject("ADODB.CONNECTION")
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ThisWorkbook.Path & ";Extended Properties=""text;HDR=Yes;FMT=Delimited"""
    Set oRS = CreateObject("ADODB.RECORDSET")
        'Now actually open the text file and import into Excel
    oRS.Open "SELECT * FROM 201403_OSA_BY_SKU_DT.csv", oConn, 3, 1, 1
    While Not oRS.EOF
        Sheets.Add After:=Sheets(Sheets.Count)
        ActiveSheet.Range("A1").CopyFromRecordset oRS, 1000000
    Wend
    Application.ScreenUpdating = True
End Sub

你可能感兴趣的:(政治经济1)