Consulting

Results 1 to 3 of 3

Thread: Insert picture in cell comments

  1. #1

    Insert picture in cell comments

    Hello.
    I am trying to get a series of pictures to import into a series of excel cells using the comments. I found some code on this site in the knowledgebase from a user named Oorang that I think is what I need: KB ID 102. It is code to automatically insert an image into the comments portion of excel.

    But I was wondering if someone might be able to help me apply it to my unique situation.

    What I need to do is take cell A1 which contains a link to an image: "www(dot)image(dot)com(slash)image01.jpg" and insert the resulting image into a comment on B1. This needs to be done for A1:B100, with the cell value in A column being a hundred different image links

    Is this even doable?
    Thanks
    Andy

  2. #2
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    So are you saying that the link in A1 will change 100 times. Or am i reading it wrong? Or is there 100 images you want to fill down column B?
    Peace of mind is found in some of the strangest places.

  3. #3
    hello austenr.
    thanks for your response. i need this to work with 100 different images in column A. i did some more digging after i posted and found this solution just in case anyone else needs it:
    Sub InsertComment()
    'www(dot)contextures(dot)com\xlcomments03.html
    Dim rngList As Range
    Dim c As Range
    Dim cmt As Comment
    Dim strPic As String

    On Error Resume Next

    Set rngList = Range("A1:A5")
    strPic = "C:\Data\"

    For Each c In rngList
    With c.Offset(0, 1)
    Set cmt = c.Comment
    If cmt Is Nothing Then
    Set cmt = .AddComment
    End If
    With cmt
    .Text Text:=""
    .Shape.Fill.UserPicture strPic & c.Value
    .Visible = False
    End With
    End With
    Next c

    thanks again for getting back to me so soon
    all the best
    andy
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •