Results 1 to 4 of 4

Emailing range problem???

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2021
    Posts
    247

    Post Emailing range problem???

    Hi,
    I have some code(below), that I am trying to use to select a range, then email as a picture.
    However, it comes up with a syntax error in the first row.
    Does anyone have any ideas on this please??

    Thanks in advance.
    Sub eMailPictureInBody()
    ''' Set Range you want to export to file
        Dim rgExp As Range
        Dim OutApp As Object
        Dim OutMail As Object
    
    
     Set rgExp = Agency Order Sheet.Range("E1:AG22")
        ''' Copy range as picture onto Clipboard
        rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
        ''' Create an empty chart with exact size of range copied
        With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
                                          Width:=rgExp.Width, Height:=rgExp.Height)
            .Name = "Pict1"
            .Activate
        End With
        
        ''' Paste into chart area, export to file, delete chart.
        ActiveChart.Paste
        ActiveSheet.ChartObjects("Pict1").Chart.Export "C:\temp\Pict1.jpg" '
        ActiveSheet.ChartObjects("Pict1").Delete
    
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        On Error Resume Next
        With OutMail
            .To = "xxxxxxxx@aol.com"
            .CC = ""
            .BCC = ""
            .Subject = "Agency requirements for Sunday"
            .HTMLBody = .HTMLBody & "<img src='c:\temp\pict1.jpg'>"
            .Display
            .Send   'or use .Display
            '
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
    
    End Sub
    Last edited by Leith Ross; 06-19-2014 at 02:37 PM. Reason: Addded Code Tagas

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Emailing a selection of spreadsheet problem / Tab name needs omitting
    By peejaygee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 03:47 AM
  2. Problem Emailing Excel sheets via Groupwise
    By Kholmes11 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2012, 01:18 PM
  3. [SOLVED] Help emailing worksheet range via Redemption
    By Timothy.Rybak@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2006, 04:00 PM
  4. [SOLVED] emailing problem
    By William Barnes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2005, 06:05 PM
  5. [SOLVED] Emailing document external link problem
    By Optiglaze in forum Excel General
    Replies: 2
    Last Post: 08-01-2005, 11:05 AM

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