Target Object

SQL*XL
home

Targets  
  Target

Description:

The Target object represents an SQL*XL output target. For example, when a select statement is executed SQL*XL has to output the data somehow. The target object encapsulates all the details for outputting data into a specific environment. A Target object is always instantiated by the SQLXL object. The the Targets property in the SQLXL object to get a reference to a specific target object.

The Target Objects that are available are:

Constant Class Name Description
litExcel clsTargetExcel Encapsulates Excel as output target. Use SQLXL.Targets( litExcel ) to create a reference.
litWord clsTargetWord Encapsulates Word as output target. Use SQLXL.Targets( litWord ) to create a reference.
litOutlook clsTargetOutlook Encapsulates Outlook as output target. Use SQLXL.Targets( litOutlook ) to create a reference.
litPDF clsTargetPDF Encapsulates a PDF file as output target. Use SQLXL.Targets( litPDF ) to create a reference. If it is not installed the target will remain empty (Nothing).
litXLS clsTargetXLS Encapsulates a binary XLS file as output target. Use SQLXL.Targets( litXLS ) to create a reference. If it is not installed the target will remain empty (Nothing).
litPivotTable clsTargetPivotTable Encapsulates a pivot table as output target. Use SQLXL.Targets(litPivotTable) to create a reference.
litText clsTargetText Encapsulates a Text/CSV file as output target. Use SQLXL.Targets( litText ) to create a reference. If it is not installed the target will remain empty (Nothing).
litNone Nothing No output it required

 

Example:

Set MS Word as output target for a query and specify that no headings should be printed.

SQLXL.SQL.setText Text:="select * from emp"
SQLXL.Targets(litWord).Headings= False
With SQLXL.SQL.Statements(1)
    Set.Target = Targets( litWord )
    .Execute
End With

Note: Please record all code through the macro recorder.