+ Reply to Thread
Results 1 to 2 of 2

Copy a range to the body in email message

Hybrid View

  1. #1
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2019
    Posts
    346

    Copy a range to the body in email message

    I am using this code to send emails from excel. It works 100%

    I want to use the same code, but to send sheet1.Range("A1:N56") as the body

    Sub SendEmail()
    Dim OutlookApp As Outlook.Application
    Dim MyItem As Outlook.MailItem
    Dim EmailAddr As String
    Dim Subj As String
    Dim Sender As String
    Dim Msg As Range
    
        Set OutlookApp = New Outlook.Application
        Set MyItem = OutlookApp.CreateItem(olMailItem)
        EmailAddr = Sheet2.Range("B1").Value
        Subj = "MANUAL TRANSMITTAL - " & Sheet1.Range("M5").Value & " - Notification"
        Sender = Sheet2.Range("E5").Value
        
        Msg = UserForm2.ComboBox1.Value & " " & UserForm1.TextBox1.Value & vbCrLf & vbCrLf
        Msg = Msg & UserForm2.TextBox2.Value & vbCrLf & vbCrLf
        Msg = Msg & UserForm2.ComboBox2.Value & vbCrLf
        Msg = Msg & Sender & vbCrLf & vbCrLf
        Msg = Msg & "Sent on " & Date & " at " & Time
            
        With MyItem
            .To = EmailAddr
            .Subject = Subj
            .Body = Msg
            
            If UserForm2.CheckBox1.Value = True Then
            .ReadReceiptRequested = True
            Else
            .ReadReceiptRequested = False
            End If
            
            If UserForm2.OptionButton1.Value = True Then
            .Display
            End If
            
            If UserForm2.OptionButton2.Value = True Then
            .Save
            End If
            
            If UserForm2.OptionButton3.Value = True Then
            .Send
            End If
        End With
    End Sub

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,
    Have a look at the links to Ron de Bruin's site which I have listed in this recent post:

    http://www.excelforum.com/1985136-post2.html

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1