Macro command Open

<< Click to Display Table of Contents >>

Navigation:  Macros > Macro commands and parameters > Macro reporting commands > Macro write to Excel >

Macro command Open

Purpose:

Opening an existing spreadsheet.

 

General notation:

Open ( FileIndex , FileName )

 

Using the Open command a spreadsheet file is assigned to a FileIndex for Read and Write commands. The FileIndex is an integer number between 1 and 9. This means that a maximum of nine spreadsheet files can be opened simultaneously. If more files have to be opened, firstly other files have to be closed using the Close command.

Writing to FileIndex 0 creates a new runtime Excel-file. It opens automatically and remains open in Excel after execution of the macro. The result has to be saved manually.

 

Example:

Open nine spreadsheet files for reading metered data in files File1, File2, ... File9:

 Loop ( Index , 1 , 9 , 1 )

         Set ( FileName , 'D:\MyDir\File' )

         Add ( FileName , Index )

         Add ( FileName , '.xls' )

         Open ( Index , FileName )

 End