Consulting

Results 1 to 20 of 20

Thread: EXCEL VBA to show images as comments

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Feb 2021
    Posts
    10
    Location

    EXCEL VBA to show images as comments

    Hi-
    I'm trying to write VBA to show images as comments for a list of item numbers.

    1 - I have a file where the product images are saved that I'm referencing
    2 - Some items are .png and some are .jpg - How do I write the code to look for either?
    3 - If a product image is missing how do I make the code skip that product and look up the next one? (Right now the code stops when it hits a product that has no image)
    4- I would like to set the size of the image as they're being distorted in the comment.

    See below for how my code is written. Thank you in advance for your help. -KEEKS

    Sub PictureToComments()
    For Each cell In Range("a4:a100000")
            cell.AddComment
            cell.Comment.Text Text:=""
            cell.Comment.Visible = True
            cell.Comment.Shape.Select
            Selection.ShapeRange.Fill.UserPicture "G:\North America Sales\Products\Necklaces\Images" & cell.Value & ".png"
            cell.Select
            cell.Comment.Visible = False
    Next
    End Sub
    Last edited by Aussiebear; 02-21-2021 at 09:01 PM. Reason: Added code tags

Posting Permissions

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