Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save an image from a worksheet to a file

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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
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?


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
Can I save an excel worksheet as my desktop image? sjp Excel Discussion (Misc queries) 2 August 21st 09 01:10 AM
Save a worksheet by itself to a new file Rich Excel Discussion (Misc queries) 2 December 9th 08 03:01 PM
how do i save an excel graph as an image file for use on the inter jimwarlick Charts and Charting in Excel 3 July 9th 07 06:05 PM
Save worksheet to seperate file? George Excel Discussion (Misc queries) 4 October 30th 06 08:30 PM
Hyperlink to an image in other worksheet, displaying entire image. twilliams Excel Worksheet Functions 0 February 7th 06 10:02 PM


All times are GMT +1. The time now is 09:39 PM.

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

About Us

"It's about Microsoft Excel"