![]() |
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 |
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 wrote in message ups.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 |
All times are GMT +1. The time now is 10:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com