How can u resize the MBs in a image.

Eric Penfold

Active Member
Joined
Nov 19, 2021
Messages
428
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I copy an image onto a Email but it`s to many MBs (20MBs) can i reduce the MBs in VBA.
Without damaging the quality or size of image.

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:=2
    Set pic = ws.Pictures.Paste
    
    pic.Select
    With Selection
        .ShapeRange.LockAspectRatio = msoTrue
        .ShapeRange.Height = 8000
 
    End With
    
    pic.Cut
    
    strBody = "<BODY style = font-size:9pt,font- family:arial><Center>" & _
              "<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
        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 & "<br>" & .HTMLBody & strBody
        On Error GoTo 0
        
    End With
    
    Set EmailItem = Nothing
    Set EmailApp = Nothing
    On Error Resume Next
    Workbooks("DailyMail.xlsx").Close
    
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi Eric Penfold. You can have a look at this link it may help. Dave
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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