Open2 - Automation
The Open2 method opens an existing document. Returns an object.
The Open2 command should be used instead of Open when the worksheet being loaded is an Excel file where the sheet name needs to be specified. It can also be used to specify any data import options when loading a data file.
Syntax
object.Open2( FileName, Options, FilterId )
Parameter |
Type |
Required/ Optional |
Default |
Description |
FileName |
String |
Required |
This provides the path and file name of the file. |
|
Options |
Optional |
"" |
See the Worksheet FilterID page for links to the import options available for opening specific data file formats.. |
|
FilterId |
Optional |
"" |
FilterId specifies the file format extension if the extension entered for FileName is unknown. |
Remarks
- The Options parameter consists of a series of semicolon-separated keywords. See Worksheet FilterID for details on the Option.
- For example, Options contains a keyword "Sheet" for opening Excel files. Use this keyword to specify a worksheet in an Excel workbook: SurferApp.Documents.Open2("d:\data\multisheet.xls", Options:="Sheet=Sheet3")
- FilterId is required if no recognized file extension is used in FileName, or if the file extension supplied can be used by more than one file format.
- FilterId is case-sensitive. File extensions are case-insensitive.
- If FilterId is used the file extension is optional.
Example 1
This example demonstrates how to open a document.
Dim Plot As Object
Set Plot = SurferApp.Documents.Open2("C:\temp\test.bob", FilterId:="dat" )
Set Plot = SurferApp.Documents.Open2("C:\temp\xlstest", Options:="Defaults=1", FilterId:="xls" )
Example 2
This script displays all the methods and properties in the Documents collection.
Used by: Documents collection