FileImport method (Excel Graph)
Imports a specified file or range, or an entire sheet of data.
expression.FileImport (FileName, Password, ImportRange, WorksheetName, OverwriteCells)
expression Required. An expression that returns an Application object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
FileName | Required | String | The file that contains the data to be imported. |
Password | Optional | Variant | The password for the file to be imported, if the file is password protected. |
ImportRange | Optional | Variant | The range of cells to be imported, if the file to be imported is a Microsoft Excel worksheet or workbook. If this argument is omitted, the complete contents of the worksheet are imported. |
WorksheetName | Optional | Variant | The name of the worksheet to be imported, if the file to be imported is an Excel workbook. |
OverwriteCells | Optional | Variant | True to specify that the user be notified before imported data overwrites existing data on the specified datasheet. The default value is True. |
This example imports data from the range A2:D5 on the worksheet named MySheet in the Microsoft Excel workbook named mynums.xls.
With myChart.Application
.FileImport FileName:="C:\mynums.xls", _
ImportRange:="A2:D5", WorksheetName:="MySheet", _
OverwriteCells:=False
End With
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.