Spreadsheet.ExportXLS

Export a spreadsheet to a XLS file.

Syntax Parameters Return Value
Function Spreadsheet.ExportXLS( _
    FileName As String, _
    Optional FirstRow As Long = 1, _
    Optional LastRow As Long = 0, _
    Optional FirstColumn As Long = 1, _
    Optional LastColumn As Long = 0, _
    Optional UseTextLabels As Boolean = True, _
    Optional CaseNamesToFirstColumn As Boolean = False, _
    Optional VariableNamesToFirstRow As Boolean = False, _
    Optional OverWriteFile As Boolean = True) As Boolean
  • FileName [in]

FilePath and/or FileName to where the exported .xls file will be saved. If a file path is not specified the .xls file will be save to the current working directory.

Type: String

  • FirstRow [in,optional]

The first row to be exported.

Type: Long

Default value: 1

  • LastRow [in,optional]

The last row to be exported. If 0 is used all rows that fall after the FirstRow specification will be exported.

Type: Long

Default value: 0

  • FirstColumn [in,optional]

The first column to be exported.

Type: Long

Default value: 1

  • LastColumn [in,optional]

The last column to be exported. If 0 is used all columns that fall after the FirstColumn specification will be exported.

Type: Long

Default value: 0

  • UseTextLabels [in,optional]

Type: Boolean

Default value: True

  • CaseNamesToFirstColumn [in,optional]

Type: Boolean

Default value: False

  • VariableNamesToFirstRow [in,optional]

Type: Boolean

Default value: False

  • OverWriteFile [in,optional]

Type: Boolean

Default value: True

Boolean

SVB Example

Exporting a spreadsheet as an Excel file:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    'assigns the active spreadsheet to the object spr
    Set spr = ActiveSpreadsheet
    'Save the spreadsheet as an Excel file.
    'File is saved as XLS1.xls, the entire spreadsheet is selected,
    'use text labels, don't use case names to first column,
    'don't use variable names to first row,
    'overwrite file if it exists
    spr.ExportXLS("C:\users\GabiM\Documents\XLS1.xls",1,0,1,5,True,False,False,True)
End Sub