OPEN.TEXT macro

Equivalent to using the Text Import Wizard to open a text file in Microsoft Excel.

Syntax

OPEN.TEXT(file_name, file_origin, start_row, file_type, text_qualifier, consecutive_delim, tab, semicolon, comma, space, other, other_char, {field_info1; field_info2;...})

File_name    is the full pathname of the text file you want to open.

File_origin    specifies the operating environment the text file was created in.

File_origin Operating system
1 Macintosh
2 Windows (ANSI)
3 MS DOS (PC-8)
Omitted Current operating environment

Start_row    is a number greater than or equal to one, specifying the row in the text file where you want to start importing into Microsoft Excel. This number should be less than the number of lines in the text file.

File_type    specifies the type of delimited text file to import:

File_type Type of file
1 or omitted Delimited
2 Fixed width

Text_qualifier    indicates the character-enclosing text fields in the text file:

Text_qualifier value Qualifier
1 or " " (double quotation mark)
2 or ' ' (single quotation mark)
3 or {None} No text qualifier

Consecutive_delim    is a logical value corresponding to the Treat Consecutive Delimiters as One check box which, if TRUE, allows consecutive delimiters (such as ",,,") to be treated as a single delimiter. If FALSE, all consecutive delimiters are considered separate column breaks.

Tab, semicolon, comma, space    are logical values corresponding to the check boxes in the Column Delimiters group. If an argument is TRUE, the check box is selected. These arguments apply only when the file_type argument is 1 or omitted (delimited file type).

Other    is a logical value indicating a custom delimiter to use in opening the text file.

Other_char    specifies the custom delimiter to use or FALSE if no custom delimiter is used.

Field_info    is an array which consists of the following elements: "column number, data_format", if file_type is 1; or "start_pos, data_format" if file_type is 2.

Related Function

TEXT.TO.COLUMNS   Parses text, as in a text file, into columns of data

Return to index