OPEN macro

Equivalent to clicking the Open command on the File menu. Opens an existing workbook.

Syntax

OPEN(file_text, update_links, read_only, format, prot_pwd, write_res_pwd, ignore_rorec, file_origin, custom_delimit, add_logical, editable, file_access, notify_logical, converter)

OPEN?(file_text, update_links, read_only, format, prot_pwd, write_res_pwd, ignore_rorec, file_origin, custom_delimit, add_logical, editable, file_access, notify_logical, converter)

File_text    is the name, as text, of the workbook you want to open. File_text can include a drive and path, and can be a network pathname. In the dialog-box form in Microsoft Excel for Windows, file_text can include an asterisk (*) to represent any sequence of characters and a question mark (?) to represent any single character.

Update_links    specifies whether and how to update external and remote references. If update_links is omitted, Microsoft Excel displays a message asking if you want to update links.

If update_links is Then Microsoft Excel
0 Updates neither external nor remote references
1 Updates external references only
2 Updates remote references only
3 Updates external and remote references

Note   When you are opening a file in WKS, WK1, or WK3 format, the update_links argument specifies whether Microsoft Excel generates charts from any graphs attached to the WKS, WK1, or WK3 file.

If update_links is Charts are
0 Not created
2 Created

Read_only    corresponds to the Read Only check box in the Open dialog box. If read_only is TRUE, the workbook can be modified but changes cannot be saved; if FALSE or omitted, changes to the workbook can be saved.

Format    specifies what character to use as a delimiter when opening text files. If format is omitted, Microsoft Excel uses the current delimiter setting.

If format is Values are separated by
1 Tabs
2 Commas
3 Spaces
4 Semicolons
5 Nothing
6 Custom characters

Prot_pwd    is the password, as text, required to unprotect a protected file. If prot_pwd is omitted and file_text requires a password, the Password dialog box is displayed. Passwords are case-sensitive. Passwords are not recorded when you open a workbook and supply the password with the macro recorder on.

Write_res_pwd    is the password, as text, required to open a read-only file with full write privileges. If write_res_pwd is omitted and file_text requires a password, the Password dialog box is displayed.

Ignore_rorec    is a logical value that controls whether the read-only recommended message is displayed. If ignore_rorec is TRUE, Microsoft Excel prevents display of the message; if FALSE or omitted, and if read_only is also FALSE or omitted, Microsoft Excel displays the alert when opening a read-only recommended workbook.

File_origin    is a number specifying whether a text file originated on the Macintosh or in Windows.

File_origin Original operating environment
1 Macintosh
2 Windows (ANSI)
3 MS-DOS (PC-8)

OmittedCurrent operating environment

Custom_delimit    is the character you want to use as a custom delimiter when opening text files.

Add_logical    is a logical value that specifies whether or not to add file_text to the open workbook. If add_logical is TRUE, the document is added; if FALSE or omitted, it is not added. This argument is for compatibility with workbooks from Microsoft Excel version 4.0.

Editable    is a logical value that corresponds to opening a file (such as a template) while holding down SHIFT key. If TRUE, editable is the equivalent to holding down the SHIFT key while clicking the OK button in the Open dialog box. If FALSE or omitted, this argument is ignored.

File_access     is a number specifying how the file is to be accessed. If the file is being opened for the first time, this argument is ignored. If the file is already opened, this argument determines how to change the user's access permissions for the file.

File Access How Accessed
1 Revert to saved copy
2 Change to read/write access
3 Change to read only access

Notify_logical    is a logical value that specifies whether the user should be notified when the shared workbook is available to be opened across a network. If TRUE, the user will be notified when the workbook is available to be opened. If FALSE or omitted, the user will not be notified when the file available to be opened.

Converter     is a number corresponding to the file converter to use to open the file. Normally, Microsoft Excel automatically determines which file converter to use; therefore, this argument can usually be excluded. If you want to be certain, however, that a specific manually installed converter be used, then include this argument. Use GET.WORKSPACE(62) to determine which numbers corresponds to all of the installed converters.

Related Functions

CLOSE   Closes the active window

FCLOSE   Closes a text file

FOPEN   Opens a file with the type of permission specified

OPEN.LINKS   Opens specified supporting workbooks

Return to index