SendObject attachment (1 Viewer)

James Deckert

Continuing to Learn
Local time
Today, 04:28
Joined
Oct 6, 2005
Messages
189
Is there a way to attach a file to an e-mail using DoCmd.SendObject? I'm using SendObject because I can't guarantee that the users machine will include Outlook. The file I want to attach is a simple .CSV file on my local hard drive.

Thanks for any ideas.
James
 

reclusivemonkey

Registered User.
Local time
Today, 09:28
Joined
Oct 5, 2004
Messages
749
Yes, this is exactly what SendObject is for. Just look for the related help file on SendObject, everything you need to know is there.
 

James Deckert

Continuing to Learn
Local time
Today, 04:28
Joined
Oct 6, 2005
Messages
189
ReclusiveMonkey,
This may be exactly what sendObject is for, and I keep looking at the help system. But I have yet to find anything which refers to an attachment or a text file. The AcSendObjectType choices refer to Access Objects, not files on the hard drive. If I use an Access Object, it does indeed make an attachment to an e-mail. However, I am trying to attach a file. If you have other info about how to do this, maybe you can write a sample docmd.SendObject statement for me. Or if there is a different way to accomplish this without specifying a specific e-mail program, that might work.

Thanks,
James

Below is the help system reference to SendObject.

The SendObject method carries out the SendObject action in Visual Basic.

expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)
expression Required. An expression that returns one of the objects in the Applies To list.

ObjectType Optional AcSendObjectType.

AcSendObjectType can be one of these AcSendObjectType constants.
acSendDataAccessPage
acSendForm
acSendModule
acSendNoObject default
acSendQuery
acSendReport
acSendTable

ObjectName Optional Variant. A 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.

OutputFormat Optional Variant.

To Optional Variant. A 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.

Cc Optional Variant. A 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.

Bcc Optional Variant. A 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.

Subject Optional Variant. A 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.

MessageText Optional Variant. A 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.

EditMessage Optional Variant. Use 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.

TemplateFile Optional Variant. A string expression that's the full name, including the path, of the file you want to use as a template for an HTML file.
 

reclusivemonkey

Registered User.
Local time
Today, 09:28
Joined
Oct 5, 2004
Messages
749
Ah I see. When you said "file", I didn't realise you meant something which wasn't produced by Access.

Yes its still possible. I have some VBA which will attach a file (or files) I have exported from Access (an .RTF version of a report), however this is for GroupWise, not OE, so I doubt it would be of any use to you. Have you searched the forum? I am 99% sure this has been answered before. If you want my to post the GW code for you to look at, of course I will.
 

cjshaw

New member
Local time
Today, 22:28
Joined
Nov 8, 2007
Messages
1
Hi

It may be a bit old now but I would be interested in the code for Groupwise attachments if it is still around.

Cheers

Chris
 

Users who are viewing this thread

Top Bottom