View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Embed image in cell

Ok, here's the code I have.....it's a crude accumulation of stuff that I got
off the newsgroups, but it works. It plays off a list of hyperlinks created
with Jim Cone's Add-in called ListFiles,(available at
http://www.realezsites.com/bus/primi...e/products.php ) which
interrogates a directory and makes a list of links in excel. Then this macro
applys the comment boxes with pictures therein to each cell in the range.
It may not work exactly the same in your application, but might light the way
some and/or maybe your code could be worked in......


Sub PicsToCommentBoxs()
'================================================
'This macro will process a list of path/filenames for image files starting
'in cell B5, installing the image file from each cell into it's Comment Box.
'Images may be viewed by mouseover.
'Macro created 2/13/2006 by Chuck Roberts
'================================================
'This section sets the Range of cells to be processed, starting at B5, if
there
'are NO cells with a value, or one cell only (B5), or more than one.
Dim rng As Range, cell As Range
With ActiveSheet
If Range("B6").Value < "" Then
Set rng = .Range(.Range("B5"), .Range("B5").End(xlDown))
ElseIf Range("b5") < "" Then
Set rng = .Range("b5")
Else
End
End If
End With
'This section runs for each cell in the above range that contains a value.
For Each cell In rng
cell.Select
On Error Resume Next
If Selection.Value < "" Then
Selection.AddComment
Selection.Comment.Visible = False
Selection.Comment.Text Text:=""
Selection.Comment.Visible = True
Selection.Comment.Shape.Select True

Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 150
Selection.ShapeRange.Width = 150

Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.UserPicture ActiveCell.Value
ActiveCell.Comment.Visible = False
Else
End
End If
Next
End Sub
hth
Vaya con Dios,
Chuck, CABGx3



"Zamdrist" wrote:

Thanks CLR

I figured out part of this:

Set Cm = Ws.Range("E2").AddComment
Cm.Shape.Fill.UserPicture Ws.Range("D2").Value

That will add a comment, and set the Comment to the picture value.

Only I need to zip down the rows, however many there may be and do the
same for each. The number of rows is indeterminable.

Forgive me as I'm not familar with the Excel object library.

Thanks