View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steven Li Steven Li is offline
external usenet poster
 
Posts: 2
Default Save an image from a worksheet to a file


-----Original Message-----
If you can find a way to load that picture into an Image

control on a Userform, you could do this:

SavePicture

UserForm1.Image1.Picture, "c:\mypicture.bmp"

But I don't know if it's possible to get the picture

from the worksheet to the image control programmatically.

If not, you could create a chart on the worksheet,

delete its contents, paste the picture onto the chart,
and use the Export method of the Chart object:

ActiveSheet.ChartObjects

(1).Chart.Export "c:\mypicture.gif"

(And then delete that chart.)


BTW, Excel doesn't have any documentation on

SavePicture, but VB6 does:
(I'm posting this as HTML, not sure if it's going to

look right as it does now)

================================================= ====

SavePicture Statement
Saves a graphic from the Picture or Image property of an

object or control (if one is associated with it) to a
file.

Syntax

SavePicture picture, stringexpression

The SavePicture statement syntax has these parts:

Part Description
picture Picture or Image control from which the

graphics file is to be created.
stringexpression Filename of the graphics file to

save.


Remarks

If a graphic was loaded from a file to the Picture

property of an object, either at design time or at run
time, and it's a bitmap, icon, metafile, or enhanced
metafile, it's saved using the same format as the
original file. If it is a GIF or JPEG file, it is saved
as a bitmap file.

Graphics in an Image property are always saved as bitmap

(.bmp) files regardless of their original format.

================================================= ====


Hope this helps,

Greg Lovern
http://PrecisionCalc.com
Get Your Numbers Right



"Steven Li" wrote in message

...
I am trying to save an image inserted on a sheet to a
file in vba, is there anyway to do that?