SendObject Action
You can use the SendObject action to include the specified Microsoft Access
datasheet,
form,
report,
module, or
data access page in an electronic mail message, where it can be viewed and forwarded. You can include objects in Microsoft Excel 2000 (*.xls), MS-DOS text (*.txt), rich-text (*.rtf), or
HTML (*.html) format in messages for Microsoft Exchange, Microsoft Mail, Microsoft Windows for Workgroups mail, or another electronic mail application that uses the Microsoft Mail Applications Programming Interface (MAPI).
If you have an electronic mail application that uses the Vendor Independent Mail (VIM) protocol and have installed and set up the
dynamic-link library (Mapivim.dll) that converts MAPI mail messages to the VIM protocol, you can send Microsoft Access objects to the VIM mail application.
Syntax
DoCmd.SendObject [
objecttype][,
objectname][,
outputformat][,
to][,
cc][,
bcc][,
subject][,
messagetext][,
editmessage][,
templatefile]
The
SendObject method has the following arguments.
ArgumentDescription
objecttypeOne of the following
intrinsic constants:
acSendDataAccessPage
acSendForm
acSendModule
acSendNoObject (default)
acSendQuery
acSendReport
acSendTableobjectnameA
string expression that's the valid name of an object of the type selected by the
objecttype argument. If you want to include the active object in the mail message, specify the object's type with the
objecttype argument and leave this argument blank. If you leave both the
objecttype and
objectname arguments blank (the default constant,
acSendNoObject, is assumed for the
objecttype argument), Microsoft Access sends a message to the electronic mail application without an included database object. If you run Visual Basic code containing the
SendObject method in a
library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.
outputformatOne of the following intrinsic constants:
acFormatDAP
acFormatHTML
acFormatRTF
acFormatTXT
acFormatXLS If you leave this argument blank, Microsoft Access prompts you for the output format.
toA string expression that lists the recipients whose names you want to put on the To line in the mail message. Separate the recipient names you specify in this argument and in the
cc and
bcc arguments with a semicolon (

or with the list
separator set on the
Number tab of the
Regional Settings Properties dialog box in Windows Control Panel. If the recipient names aren't recognized by the mail application, the message isn't sent and an error occurs. If you leave this argument blank, Microsoft Access prompts you for the recipients.
ccA string expression that lists the recipients whose names you want to put on the Cc line in the mail message. If you leave this argument blank, the Cc line in the mail message is blank.
bccA string expression that lists the recipients whose names you want to put on the Bcc line in the mail message. If you leave this argument blank, the Bcc line in the mail message is blank.
subjectA string expression containing the text you want to put on the Subject line in the mail message. If you leave this argument blank, the Subject line in the mail message is blank.
messagetextA string expression containing the text you want to include in the body of the mail message, after the object. If you leave this argument blank, the object is all that's included in the body of the mail message.
editmessageUse
True (–1) to open the electronic mail application immediately with the message loaded, so the message can be edited. Use
False (0) to send the message without editing it. If you leave this argument blank, the default (
True) is assumed.
templatefileA string expression that's the full name, including the path, of the file you want to use as a template for an
HTML file.