Forum Discussion
DuyTan
Sep 22, 2021Copper Contributor
Please, I want to display image for column with content URL in excel.
I want to display image for column with content URL Hope the helping. thanks a lot.
Juliano-Petrukio
Sep 22, 2021Bronze Contributor
It required VBA for that. Also a frame to show the image.
One sugestion is using cell comments as frame. So when the user hover the mouse an image is shown.
Considering cell B2 with the image path you can type on C2 the following UDF
Public Function AddCommentWithImage(ByRef ImagePath As String)
Dim rng As Range, cmt As Comment
Set rng = ActiveCell
If Not (rng.Comment Is Nothing) Then rng.Comment.Delete
Set cmt = rng.AddComment
cmt.Text Text:=""
With cmt.Shape
.Fill.UserPicture ImagePath
.Width = 481.5864
.Height = 359.7734
End With
End Function
Juliano-Petrukio
Sep 22, 2021Bronze Contributor
If it worked, please hit the like button and flag the post as solved.
- DuyTanSep 22, 2021Copper ContributorGood Idea
but i want the image to be in the cell, do you have a better solution?- Juliano-PetrukioSep 22, 2021Bronze ContributorAs I told you, a frame is required.
There is no way you put a image inside a cell. You can put over a cell a frame (Shape, Image Control) or in excel backgroun (All the cells with one single image) . But theses objects are nightmare because if the user decides to change the column or the row size, it will make a mess on your layout. The best option is using a comment as image frame. The other solution is create a userform to show all pictures from the list or show an individual picture.
This is another type of approach and it depends of your project as well.- DuyTanSep 22, 2021Copper Contributor
I agree with you! i am having problem when i select column "avata". it does not display the image, the path is " [@[name.1]].avata " i want to show the image in this case, not the path