2017-01-30 67 views

回答

0

您可以使用下面的代碼導入文件。此代碼假定您正在從Excel文件導入一張工作表,並且其名稱爲Sales。

Sub Main 
    Call ImportExcel("Sales.xlsx", "Sales") 
End Sub 

Sub ImportExcel(FileName As String, SheetName As String) 
    Dim dbName As String 

    dbName = Client.LocateInputFile(FileName) 
    Set task = Client.GetImportTask("ImportExcel") 
    task.FileToImport = dbName 
    task.SheetToImport = SheetName 
    task.OutputFilePrefix = "Excel" 
    task.FirstRowIsFieldName = "True" 
    task.EmptyNumericFieldAsZero = "False" 
    task.PerformTask 

    Set task = Nothing 
End Sub 
相關問題