Hi,
I'm using the below syntax in VBA to convert excel cells into JPG and paste onto email body and send email. It works fine, however I would like to increase the size of the picture - please could someone guide me how to do it?
I'm using the below syntax in VBA to convert excel cells into JPG and paste onto email body and send email. It works fine, however I would like to increase the size of the picture - please could someone guide me how to do it?
VBA Code:
Sub Email_jpg()
Dim OutApp As Object
Dim OutMail As Object
Dim table As Range
Dim pic As Picture
Dim ws As Worksheet
Dim wordDoc
Dim a As String, b As String, c1 As String, c2 As String, c3 As String, d As String
Dim Rng As Range
Set ws = Worksheets("Sheet1")
Set Rng = ws.Range("A6:F20")
'sort data from smallest to largest number in column B
Rng.sort Key1:=Range("F:F"), Order1:=xlDescending
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set ws = ThisWorkbook.Sheets("Sheet1")
Set table = ws.Range("A3:F38")
ws.Activate
table.CopyPicture
Set pic = ws.Pictures.Paste
pic.Cut
On Error Resume Next
With OutMail
.To = Range("G1").Value
.CC = Range("J1").Value
.Subject = "XYZ"
.display
Set wordDoc = OutMail.GetInspector.WordEditor
With wordDoc.Range
.PasteandFormat wdChartPicture
.insertParagraphAfter
.insertParagraphAfter
.InsertAfter "thanks,"
.insertParagraphAfter
.InsertAfter "ABC"
.insertParagraphAfter
.InsertAfter "XYZ"
.insertParagraphAfter
.InsertAfter
End With
.HTMLBody = "<BODY style = font-size:11pt; font-family:Calibri >" & _
"Hi, <p>xyz <p>" & .HTMLBody
On Error Resume Next
.send
Application.Visible = True
If Err Then
MsgBox "E-mail was not sent", vbExclamation
Else
MsgBox "Email was sent!!", vbInformation
End If
On Error GoTo 0
End With
Set OutApp = Nothing
Set OutMail = Nothing
End Sub