ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pictures/Graphics in/out Excel-cells (https://www.excelbanter.com/excel-programming/375176-pictures-graphics-out-excel-cells.html)

baj

Pictures/Graphics in/out Excel-cells
 
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


Peter T

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




baj

Pictures/Graphics in/out Excel-cells
 

Thanks Peter... but I think I'll stick to the "more easy" uploading of
the graphic files
with a path, that's what I'm doing now. So I'll just refine it by
putting those files in one
map & directory.

Thanks again,
Baj



All times are GMT +1. The time now is 06:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com