Pasting a Shape into email

Eric Penfold

Active Member
Joined
Nov 19, 2021
Messages
431
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Trying to paste a shape into an email with hyperlink in the shape.
Also make sure the shape stay`s where it is on the excel sheet.

VBA Code:
ws.Shapes.Range(Array("Brainstorm Suggestions")).Select
             With Selection
             .Paste
            End with


VBA Code:
Option Explicit
Sub SendDailyMailEmail()

    Dim wb     As Workbook
    Dim ws     As Worksheet
    Dim tbl    As Range
    Dim LRow   As Long
    Dim EmailApp As Object, EmailItem As Object
    Dim Pic    As Picture
    Dim MyShp As Shape
    Dim WordDoc
    
    Set EmailApp = CreateObject("Outlook.Application")
    Set EmailItem = EmailApp.CreateItem(0)
    Set wb = Workbooks("MyPersonal.xlsb")
    Set ws = wb.Sheets("DailyMail")
    LRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
    Set tbl = ws.Range("A1:Q" & LRow)
    
    ws.Activate
    tbl.Copy
    Set Pic = ws.Pictures.Paste
    
    Pic.Select
    
    Pic.Cut
    
    With EmailItem
        .To = ""
        .Subject = "Daily Mail" & " " & Format(Date, "dd-mm-yy")
        .Display
         Set WordDoc = EmailItem.GetInspector.WordEditor
        With WordDoc.Range
            .PasteAndFormat 13
             ws.Shapes.Range(Array("Brainstorm Suggestions")).Select
             With Selection
             .Paste
             End With
            .InsertParagraphafter
            .InsertParagraphafter
            .InsertAfter "Kind Regards,"
        End With
    End With
    
    
    
    On Error GoTo 0
    
    Set EmailItem = Nothing
    Set EmailApp = Nothing
    
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Further to above i need the shape to retain it`s hyper link.
I`ve managed to show the shape in Email Body on wordoc but hyperlink goes how could i avoid that?
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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