+ Reply to Thread
Results 1 to 2 of 2

Sending a range as an image attached to an e-mail

  1. #1
    robertp@profund.com
    Guest

    Sending a range as an image attached to an e-mail

    Hello,

    I've read many threads on here recently regarding sending e-mails
    containing ranges of cells from excel which has been very helpful.

    I'm sure I also read how to attach an image of a range (after using the
    range.copypicture method) to an e-mail, but I can no longer find it.

    I don't want to embed the image directly into a HTML or rich text
    e-mail, just as a bmp or jpg attachment.

    I wonder if anybody could please explain how to do this.

    Thanks,

    Rob Pearce


  2. #2
    Ron de Bruin
    Guest

    Re: Sending a range as an image attached to an e-mail

    Hi Rob

    You can use code like this to create a gif file

    Sub Testing()
    Application.ScreenUpdating = False
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture

    Set ctoTheChartHolder = ActiveSheet.ChartObjects.Add(0, 0, 800, 600)

    Set chtTheChart = ctoTheChartHolder.Chart

    ' Paste the picture onto the chart and
    ' set an object variable for it
    ctoTheChartHolder.Activate
    With chtTheChart
    .ChartArea.Select
    .Paste
    Set picThePicture = .Pictures(1)
    End With

    ' Set the picture's properties...
    With picThePicture
    .Left = 0
    .Top = 0
    sglWidth = .Width + 7
    sglHeight = .Height + 7
    End With

    ' Change the size of the chart object to fit the picture
    'better
    With ctoTheChartHolder
    .Border.LineStyle = xlNone
    .Width = sglWidth
    .Height = sglHeight
    End With
    ' Export the chart as a graphics file
    blnRet = chtTheChart.Export(Filename:="c:\range.gif", _
    FilterName:="gif", Interactive:=False)
    ctoTheChartHolder.Delete
    Application.ScreenUpdating = True
    End Sub

    Or use Harald's code
    http://www.mvps.org/dmcritchie/excel/xl2gif.htm

    Then you can use the Outlook code on my site to add the gif to the mail
    http://www.rondebruin.nl/sendmail.htm



    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    <robertp@profund.com> wrote in message news:1147964176.089403.74070@j33g2000cwa.googlegroups.com...
    > Hello,
    >
    > I've read many threads on here recently regarding sending e-mails
    > containing ranges of cells from excel which has been very helpful.
    >
    > I'm sure I also read how to attach an image of a range (after using the
    > range.copypicture method) to an e-mail, but I can no longer find it.
    >
    > I don't want to embed the image directly into a HTML or rich text
    > e-mail, just as a bmp or jpg attachment.
    >
    > I wonder if anybody could please explain how to do this.
    >
    > Thanks,
    >
    > Rob Pearce
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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