MAPISendDocuments (VB)

The Visual Basic MAPISendDocuments function sends a standard message with one or more attached files and a cover note. The cover note is a dialog box that allows the user to enter a list of recipients and an optional message.

Quick Info

Header file: MAPIVB32.BAS

MAPISendDocuments(

    UIParam as Long,
    DelimChar as String,
    FullPaths as String,
    FileNames as String,
    Reserved as Long) as Long

Parameters

UIParam
[in] Parent window handle or zero, indicating that if a dialog box is displayed, it is application modal. If no dialog box is displayed during the call, the UIParam parameter is ignored.
DelimChar
[in] String containing the character used to delimit the names in the FullPaths and FileNames parameters. This character should not be used in filenames on your operating system.
FullPaths
[in] String containing the list of full paths, including drive letters, for the attached files. The list is formed by concatenating correctly formed file paths separated by the character specified in the DelimChar parameter. An example of a valid list is:
C:\TMP\TEMP1.DOC;C:\TMP\TEMP2.DOC 
 

The files specified in FullPaths are added to the message as file attachments. If FullPaths contains an empty string, the Send Note dialog box is displayed with no attached files.

FileNames
[in] String containing the list of the original filenames as they should be displayed in the message. When multiple names are specified, the list is formed by concatenating the filenames separated by the character specified in the DelimChar parameter. An example is:
MEMO.DOC;EXPENSES.DOC 
 

If there is no value for the FileNames parameter or if it is empty, MAPISendDocuments sets the filenames set to the filename values indicated by the FullPaths parameter.

Reserved
Reserved; must be zero.

Return Values

MAPI_E_ATTACHMENT_NOT_FOUND
An attachment could not be located in the specified path. Either the drive letter was invalid, the path was not found on that drive, or the file was not found in that path.
MAPI_E_ATTACHMENT_OPEN_FAILURE
One or more files in the FullPaths parameter could not be located. No message was sent.
MAPI_E_ATTACHMENT_WRITE_FAILURE
An attachment could not be written to a temporary file. Check directory permissions.
MAPI_E_FAILURE
One or more unspecified errors occurred while sending the message. It is not known if the message was sent.
MAPI_E_INSUFFICIENT_MEMORY
There was insufficient memory to proceed.
MAPI_E_LOGIN_FAILURE
There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. No message was sent.
MAPI_E_USER_ABORT
The user canceled the process. No message was sent.
SUCCESS_SUCCESS
The call succeeded and the message was sent.

Remarks

Calling the MAPISendDocuments function displays a Send Note dialog box, which prompts the user to send a message with data file attachments. Attachments can include the active document or all the currently open documents in the Windows-based application that called MAPISendDocuments. This function is used primarily for calls from a macro or scripting language, often found in applications such as spreadsheet or word-processing programs.

There is no default identification when MAPISendDocuments is called; a standard logon dialog box appears. After the user provides a mailbox name and password, the Send Note dialog box appears.

The user's default messaging options are used as the default dialog box values. The caller is responsible for deleting temporary files created when using MAPISendDocuments.

The declaration of this function for the 32-bit Visual Basic runtime is:

MAPISendDocuments(

ByVal UIParam&,
ByVal DelimStr$,
ByVal FilePaths$,
ByVal FileNames$,
ByVal Reserved&) As Long