Trying to improve quality of image on Email.

Eric Penfold

Active Member
Joined
Nov 19, 2021
Messages
431
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
This code below is set to
VBA Code:
 PasteAndFormat 13
but it`s blurry so what Format should I use instead?

I`ve tried various different Formats but it just makes the image small & I can`t seem to change the size with VBA??

VBA Code:
Sub SendDailyMailEmail()

    Dim wb     As Workbook
    Dim ws     As Worksheet, ews As Worksheet
    Dim Tbl    As Range, rng As Range
    Dim LRow   As Long
    Dim EmailApp As Object, EmailItem As Object
    Dim pic    As Picture
    Dim WordDoc
    Dim strBody As String, Text As String
    
    Set EmailApp = CreateObject("Outlook.Application")
    Set EmailItem = EmailApp.CreateItem(0)
    Set wb = Workbooks("Personal.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.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    Set pic = ws.Pictures.Paste
    
    pic.Select
    With Selection
        .ShapeRange.LockAspectRatio = msoTrue
        .ShapeRange.Height = 2000
    End With
    
    pic.Cut
    
    strBody = "<BODY style = font-size:9pt,font- family:arial>" & _
              "<br><br><a href=""https://app.smartsheet.com/b/form/05bee75bfa6a47b7b5c5cff74e64dc3d"">Brainstorm Suggestions</a><br><br>" & _
              "<a href=""\\DF-AZ-FILE01\Company\R&D\Product Development\Product Ideas.xlsx"">Product Ideas</a>"
    
    
    On Error Resume Next
    With EmailItem
        .To = "Drainfast Daily Mail"
        .CC = ""
        .Subject = "Drainfast Daily Mail" & " " & Format(Date, "dd-mm-yyyy")
        .Display
        .HTMLBody = strBody & .HTMLBody
        On Error GoTo 0
        
        Set WordDoc = EmailItem.GetInspector.WordEditor
        
        On Error Resume Next
        With WordDoc.Range
            .PasteAndFormat 13
            .Application.Selection.Paragraphs.Alignment = wdAlignParagraphCenter
        End With
        
        Text = "<BODY style = font-size:9pt,font- family:arial>" & _
               "Morning Staff,<br><br>Daily Mail Below<br><br><br>"
        .HTMLBody = Text & .HTMLBody
        
        On Error GoTo 0
    End With
    
    Set EmailItem = Nothing
    Set EmailApp = Nothing
    On Error Resume Next
    Workbooks("DailyMail.xlsx").Close
    
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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