View Single Post
  #1 (permalink)  
Old June 9th, 2004, 04:57 AM
tucker tucker is offline
Authorized User
Join Date: Dec 2003
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Email attachments

Hello all,

Does any know how to attach multiple files to outlook emails using VBA. Below is the code which i am using and woirks fine for single attachments.

  ' Create object variables
    Dim objOutlook As Outlook.Application
    Dim objMessage As Outlook.MailItem

    ' Create other variables
    Dim strFileName As String
    Dim strRecipient As String
    Dim strSubject As String
    Dim strBody As String
    Dim strTitle As String

    ' Open Outlook and create new mailitem
    Set objOutlook = CreateObject("Outlook.Application")
    Set objMessage = objOutlook.CreateItem(olMailItem)

       ' Assign values to variables
    strFileName = "c:\temp\testfile.xls"
    strRecipient = "tucker"
    strSubject = "Daily Report"
    strBody = "Please find attached daily report" & vbCrLf & vbCrLf
    strTitle = "Daily Report"

    ' Populate MailItem
    With objMessage
        .To = strRecipient
        .Subject = strSubject
        .Body = strBody
        .Attachments.Add strFileName, , , strTitle
    End With

    ' Release object variables
    Set objOutlook = Nothing
    Set objMessage = Nothing

Please Help

Reply With Quote