Excel VBA add data to oulook email message

lancegallagher_expertsexchange
lancegallagher_expertsexchange used Ask the Experts™
on
Hello all,

I have an excel spreadsheet that I use to send out email from outlook.

I need to add a small table of hyperlinks into the body of each email or to copy and paste the table from excel into the body of an email.

Can anyone help?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2012
Commented:
Here's an example of how to copy and paste a range of hyperlinks into an outlook email:

Option Explicit
Const olMailItem = 0 'for late binding
Sub sendOutlookEmailRangeCopy()
Dim oOutlook As Object 'Outlook.Application 'Early Binding
Dim oMailItem As Object 'Outlook.MailItem 'Early Binding
Dim rng As Range
Dim r As Range

    Set oOutlook = CreateObject("Outlook.Application")
    Set oMailItem = oOutlook.CreateItem(olMailItem)
    
    Set rng = Range("C6:C10")
    
    With oMailItem
        .Subject = "test email"
        .To = Range("C1").Value 'change the to email address here, or pull from worksheet, or whatever
        For Each r In rng
            .Body = .Body & vbCrLf & r.Value
        Next r
        .Display 'comment this out and uncomment next line to actually send programmatically
        '.Send
    End With
End Sub

Open in new window


See attached.

Dave
sendEmailTable-r1.xls
Great, thanks for your help !!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial