View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Pictures/Graphics in/out Excel-cells

Hi Baj,

Whether the picture is in a comment or some other shape would in effect mean
copying the picture (Shift Edit), saving to from clipboard to file (API's)
and re-loading (.LoadPicture) to the form's picture property. Quite a lot of
code, you can get the essentials from Stephen Bullen's PastPicture.zip
(intended for charts).
http://www.oaltd.co.uk/Excel/Default.htm

If viable maybe you can also ship image files with the xls and store their
file names say in hidden cells.

A simpler way would be to use an Image control (Controls toolbox menu), then
do something like -

Me.Picture = ActiveSheet.Image1.Picture (assuming 'Me' is in the form's
code).

You might also want to look at the form's PictureAligment and
PictureSizeMode properties.

As with all objects on a sheet, other than comments, the image control is
not directly linked to a cell. So you would also need to devise some a means
to relate particular images with cells. Perhaps loop through your images
looking for their TopLeftCell property. Though of course if you can ensure a
given named image is where you expect it to be that would make things
easier.

Regards,
Peter T


"baj" wrote in message
oups.com...
Hi all,

I know it's possible to insert a graphic/picture in an Excel-cell via
'comment'.

But is it also possible to retrieve these pictures to use them
elsewhere ?

Suppose I have a picture inserted in cell (1,1) of Sheet "Try", and I
start a program that begins with showing a userform "Screen1"...
I want the background of "Screen1" being filled with the picture in
cell(1,1)...
Is there somekind of instruction that will result in doing so ?

A bit like :
Screen1.Picture =
Thisworkbook.Sheets("Try").Range(.Cells(1,1),.Cell s(1,1)).????

In which 'compartement' of the cell is the picture enclosed ?

I hope someone can point me the way.

Greetings & Thanks from
Baj