Results 1 to 2 of 2

Email worksheet (attached as PDF and embedded in email)

Threaded View

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    Netherlands
    MS-Off Ver
    MS 2013
    Posts
    15

    Email worksheet (attached as PDF and embedded in email)

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Attaching an embedded PDF file in my worksheet to a new email
    By AnthonyGFS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2017, 04:24 AM
  2. [SOLVED] Send worksheet with charts and embedded images as email attachment
    By Villalobos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2017, 08:13 PM
  3. attach different worksheet and email them tdifferent email address through macro/vba/addin
    By arunverma004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2014, 08:20 AM
  4. [SOLVED] Email Macro to attach a non active worksheet to outlook email
    By mickgibbons1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2013, 08:38 PM
  5. Replies: 5
    Last Post: 12-17-2012, 05:10 PM
  6. email excel file or worksheet as an attachment to multiple email addresses
    By jgeagle5 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2009, 03:40 PM
  7. Email a copy of a sheet to a specific person using an email on the worksheet. - VBA
    By j_lad_1999 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2009, 11:38 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1