Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Thanked 0 Times in 0 Posts

    sending emails and attachments via VBA? (2000 SP3)

    Hi, is there any way to tell excel to take any email address found in cell A1 and create an email to that email address and add a PDF attachment that is linked in cell B1? Then do the same thing in A2 and B2, etc.

    I have a bunch of email addresses in column A and a bunch of different file links in column B and I'm trying to figure out a way to do this more quickly.

    Any ideas would be very much appreciated.


  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Dublin, Ireland, Republic of
    Thanked 0 Times in 0 Posts

    Re: sending emails and attachments via VBA? (2000 SP3)

    You did not say what eMail client you use, but th efolowing should work with Outlook. If you use some other client post back.
    This code will look at the range A1:A10 (amend to suit) of bthe active sheet and send a mail addressed to the contents of the cell and attach a file named in the adjacent cell in column B. You need to ensure that you have valid email addresses in column A and the full path and file name in column B.

    Sub SendFiles()
    Dim objOL, objMail
    Dim oCell As Range
    Set objOL = CreateObject("Outlook.Application")
    For Each oCell In Range("A1:A10")
    Set objMail = objOL.CreateItem(olMailItem)
    With objMail
    .To = oCell.Text
    .Subject = "Subject" ' Optional Subject matter
    .Body = "Message" ' Optional body text
    .Attachments.Add oCell.Offset(0, 1).Text
    End With
    Set objMail = Nothing
    Set objOL = Nothing
    End Sub

    Andrew C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts