Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i open an e mail with attached file that ends with xls ganymede New Users to Excel 1 March 26th 09 02:24 PM
read xls spreadsheet attached to e-mail bdwhite Excel Discussion (Misc queries) 1 August 18th 08 06:42 PM
General mail failure when sending e-mail from Excel Adrienne Excel Discussion (Misc queries) 5 November 4th 05 12:59 PM
I can't see pictures attached in my mail, I have to save than see Hosam Khalaf Excel Discussion (Misc queries) 1 September 30th 05 02:15 AM


All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"