copy and past to body of email when option button is clicked

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, I am trying to get this code to copy and paste to the body of an email before sending it out. the cells that need to be copied are B4 : J13. I cant get it to display the email? Any help would be greatly appreciated. Thank you -

Code:
Sub SendEmail()
     
     
    Dim SendingRng As Range
    On Error GoTo StopMacro
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With
     
     
    Set displayRng = Worksheets("Entry Sheet").Range("B4:J13")
     
     
    With SendingRng
         
         
        .Parent.Select
        .Select
         
         
         ' Create the mail and send it
        ActiveWorkbook.EnvelopeVisible = True
        With .Parent.MailEnvelope
             
             
            .Introduction = "Status Update"
             
             
            With .Item
                .To = "400243@fedex.com"
                .CC = ""
                .BCC = ""
                .Subject = "My subject"
                .display
            End With
             
             
        End With
         
         
    End With
StopMacro:
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
    ActiveWorkbook.EnvelopeVisible = False
     
     
End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi,


The WITH block is using SendingRng. It needs to be using displyaRng as this is the range you are copying from the worksheet.
If you step through the code using F8 you will see it skip the With block completely.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top