Full Version: Sending an email with 2 workbooks as attachments
UtterAccess Discussion Forums > Microsoft® Office > Microsoft Excel
AchyBreakyHeart
Hi all,

Is it possible to send out 2 workbooks attached to an email with multiple reciepients? I've tried to send the workbooks individually using the sendmail function but somehow the second workbook always get stuck in the outbox and it isn't sent out at all

Can anyone help me on this? :(
sas_xpert
What mail software are you using, and what are you doing to send the mail message...
KingMartin
Hello,

see if the following snippet helps:

CODE
Sub MailMe()
    Dim OutApp As Object
    Dim OutMail As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
        .To = "test@whatever.com"
        .CC = ""
        .BCC = ""
        .Subject = "Subject here"
        .Body = "Hello"
        .Attachments.Add "C:\Book1.xls"
        .Attachments.Add "C:\Book2.xls"
        .Send
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub


(late binding, no reference to Outlook needed)

smile.gif
Martin
AchyBreakyHeart
Actually the mail program that is being used is outlook express
Will the snippet work with outlook express?

Jamie
AchyBreakyHeart
The object to be created is Outlook.application
what do you do if you wanna use the outlook express application?
cos the mail server and everything is set up using the outlook express application

Jamie
KingMartin
Hi again Jamie,

I am using Outlook 2k and I am not sure if Outlook Express supports VBA, not sure at all.

May be that sending your workbooks one by one via sendmail is the only option... Unfortunately I can't test it for you.

Regards,
Martin
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.