Email with attachment?

servoss

Registered User.
Local time
Today, 02:46
Joined
Dec 31, 2002
Messages
46
Using VBA, tied to a form button, I'd like to open an email note with a file as an attachment. i can open the note, insert an address, insert a subject, and insert message text, but cannot figure out how to add the attachment.

I'm currently using DoCmd.SendObject to create the message and add the text information. But, I'm not sure how to add an attachment. Can I using SendObject? If not, is there another approach?

Thanks, in advance,
Tom
 
sendboject. one the parameters attaches a named table query report etc as an attachment. you can then specifiy the style for the attachment
 
Super, for items within the database, but...

can I attach a file saved to the local harddrive in the same manner (ie using sendobject)?
 
Code:
Private Sub CommandButton1_Click()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItemFromTemplate("<absolute file path to template here>")

myItem.Subject = "mailsubjectline"
myItem.Attachments.Add ("<absolute attachment path here>")
myItem.Display

End Sub

You may need to add a reference from tools for the Outlook object library
 
createitemfromtemplate template?

xaviermobius said:
Code:
Private Sub CommandButton1_Click()
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItemFromTemplate("<absolute file path to template here>")

myItem.Subject = "mailsubjectline"
myItem.Attachments.Add ("<absolute attachment path here>")
myItem.Display

End Sub

You may need to add a reference from tools for the Outlook object library

What sort of templat is being sought for the createitemfromtemplate argument? Is there a default template for Outlook email notes? Can I avoid having to specify this since I may not know the path for a template?

Thaniks for the help - I'm almost there...

Tom
 

Users who are viewing this thread

Back
Top Bottom