Microsoft Office Tutorials and References
In Depth Information
After you’ve created one or more workbooks, you’ll probably want to open them at some point
with the Wo rkbooks collection’s Open method, which, in its simplest form, appears as follows:
You do have plenty more options when you open a workbook, however. The Open method has
the following full syntax:
expression.Open( FileName , UpdateLinks , ReadOnly , Format Password WriteResPassword , ,
IgnoreReadOnlyRecommended , Origin , Delimiter , Editable , Notify ,
Converter AddToMru , Local , CorruptLoad ) ,
Table 7-1 describes the parameters available for use with the Workbooks.Open method. Of par
ticular interest are the ReadOnly parameter, which requires that the user running your macro
open the workbook in read-only mode; the Password parameter, which need only be set if the
workbook is password protected; and the Delimiter parameter, which specifies the character
used to separate fields if the file the user is opening is a text file.
You’ll learn more about opening text files later in this section.
Table 7-1. The Parameters Associated with the Workbooks.Open
Required string specifying the name and path of the file to open.
Tells Excel how to handle any links from the workbook to other
workbooks. 0 means no updates, 1 means update external
references, 2 means update remote references, and 3 means
update both external and remote references.
When set to True , opens the workbook in read-only mode.
A string that contains the password required to open the workbook.
If you omit the argument, the regular Excel password protection
routine will take over.
A string that contains the password required to write to a
writereserved workbook. If you omit the argument, the regular Excel
password protection routine will take over.
If the workbook was saved with the Read-Only Recommended option
turned on, setting this parameter to True causes Excel to skip
showing the Read-Only Recommended message box when the
workbook is opened.
Indicates the operating system used to create the file. The three
constants are xlWindows , xlMacintosh , and xlMSDOS . If this
parameter isn’t specified, Excel uses the current operating system.