Hi,
I am trying to upload a page in a spreadsheet to an email.
I have multiple graphs at the top, followed by a filtered list at the bottom.
I want to add the whole thing (graphs and filtered list) as a PDF (currently getting graphs and filter headings, no list below).
I also want to add the Graphs as images and the list below embedded in the email (currently get 1 graph, and headings, no list).
Still new to this - sorry about the messy code !
Sub EmailProcess() '
Dim Fname As String 'Email with DMS Header
Dim SFname As String
Dim chart_number As Integer
Dim rng As Range 'Create Outlook Object
Dim xOutlookObj As Object
Dim xEmailObj As Object
Dim Cell As Range
Dim ws As Worksheet
Dim lrow As Long
'Email ProcessT2 Update
'Set Header ratio to 100% for email
Sheets("T2-Process").Activate
ActiveWindow.Zoom = 100
Fname = ""
SFname = ""
'File path/name of the jpg file
Fname = Environ$("temp") & "\Process_Header.jpg"
'Fname = "DMS_Header.jpg"
SFname = "<img src='cid:Process_Header.jpg'width=width*1.4 height=heigth*1.4>"
'Save Charts as jpg file
ActiveSheet.ChartObjects("Chart 1").Chart.Export _
Filename:=Fname, FilterName:="jpg"
Debug.Print Fname
'PDF/ Email
ThisWorkbook.Sheets(Array("T2-Process")).Select
lrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
'Set rng = Sheets("T2-Process").Range("B1:BM" & lrow)
ActiveSheet.PageSetup.PrintArea = Range("B1:BM" & lrow).Address
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Public\Process.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
lrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set rng = Sheets("T2-Process").Range("B20:BM" & lrow)
Set xOutlookObj = CreateObject("Outlook.Application")
Set xEmailObj = xOutlookObj.CreateItem(0)
With xEmailObj
.Display
.To = "xx <xx.xx@xx.com>"
.CC = "xx <xx.xx@xx.com>"
.Subject = "T2 DMS Comms"
.Attachments.Add "C:\Users\Public\Process.pdf"
.Attachments.Add Fname
.HTMLBody = SFname & RangetoHTML(rng)
If DisplayEmail = False Then
'.Send
End If
End With
ThisWorkbook.Sheets("T2-Process").Select
End Sub
Bookmarks