TargetOutlook Object

SQL*XL
home

Class clsTargetOutlook is a subclass of:

Target

Description:

The TargetOutlook object implements the functionality to output data from SQL*XL to MS Outlook. The properties of TargetOutlook determine the way data is output to Outlook. To obtain a reference to the targetOutlook object use the Targets property of the SQLXL object. Example: SQLXL.Targets( litOutlook ).Headings = False

Physically, output is generated by the Statement objects notably the StmtDQL object that implements select statements. The execute method of the Statement outputs the data according to the setting of the Target property on the Statement. If Statement.Target = litOutlook then output will be generated in Outlook.

Properties:

Name Data Type Description
Headings As Boolean Print column headings
MailFormat As Byte Use HTML or plain text as mail format. Possible values:
litHTML
litPlainText
Recipient As String The email address where you want the email to be sent to.
SendImmediately As Boolean When set to True will send the email straight after all the data was put in.
Subject As String The email subject or titel.
Transpose As Boolean When set to True causes Database rows to be placed in Table columns.
When set to False causes Database rows to be placed in Table rows.

 

Example:

Send output of a query to a friend by email:


SQLXL.SQL.setText Text:= "select * from emp"
With Targets(litOutlook)
    .Headings = True
    .Recipient = myfriend@hotmail.com
    .Subject= "Just queried the emp table..."
    .MailFormat = litHTML
End With
With SQLXL.Statements(1)
    Set .Target = Targets( litOutlook )
    .Execute
End With

Note: Please record all code through the macro recorder.