Pictures in Cells in Excel?

Pictures in Cells in Excel?

Post by Joe 9 » Sat, 27 Sep 2003 06:39:12


Any way to make a picture stick/bind to a cell in Excel.

The handheld auditing program we use exports the data, including photos to
excel fine, and places the picture over the cell intended, top and left. I
know how to resize it to the size of the cell, but want to make it a bit
smaller than the cell and centre it on the cell to give a small border of
white space around it. I can make it smaller than the cell, but its still
top and left aligned to the cell. the only alignment adjustments I can find
work in relation to the sheet, and not to a cell?

Working in Excel 2000 (that's what my users have)

Thanks
 
 
 

Pictures in Cells in Excel?

Post by Tom Ogilv » Sun, 28 Sep 2003 23:49:10

Sub Tester2()
Dim pic As OLEObject
Dim rng As Range
Dim lBorder As Long
lBorder = 8
For Each pic In ActiveSheet.Pictures
Set rng = pic.TopLeftCell
pic.Top = rng.Top + lBorder
pic.Left = rng.Left + lBorder
pic.Width = rng.Width - 2 * lBorder
pic.Height = rng.Height - 2 * lBorder
Next

End Sub





find

 
 
 

Pictures in Cells in Excel?

Post by Joe 9 » Mon, 29 Sep 2003 00:53:15

Thanks

Will give it a go






to
I
of
still
 
 
 

Pictures in Cells in Excel?

Post by Joe 9 » Wed, 08 Oct 2003 08:04:00

Tom

Couldn't get this code to work, but was able to fix it by using:

mydocument = Worksheets(1)
For Each sh in mydocument.Shapes

and changing all the "pic" to "sh"

I still cannot figure out how to select a single shape based upon the range
it is in? e.g. if a picture is completely inside a cell, and this is the
activecell, how do I then select the picture within the cell with code?
(assume I have many rows each with a picture inside a cell) and I want to
work on only one picture, not the shapes collection.

regards

Joe





to
I
of
still