LoadText Method

Loads and parses the specified text file into a worksheet. The contents of the text file are loaded into the worksheet beginning at the specified cell. Existing cell contents will be overwritten.

expression.LoadText(File, Delimiters, ConsecutiveDelimAsOne, TextQualifier)

*expression   * An expression that returns a Range object.

File    Required String. Specifies the name of the text file.

Delimiters    Optional String. Specifies the field delimiters. The default value is no delimiter.

ConsecutiveDelimAsOne    Optional Boolean. True to have consecutive delimiters considered as a single delimiter. The default value is False.

TextQualifier    Optional String. Specifies the text qualifier. The default value is the double quotation mark character.

Example

This example inserts a tab-delimited text file into the active worksheet of Spreadsheet1. The contents of the text file will begin in cell B10.

Spreadsheet1.ActiveSheet.Range("B10").LoadText "tabfile.txt", Chr$(9)

Applies to | Range Object

See Also | Load Method