Page 1 of 3 123 LastLast
Results 1 to 15 of 45
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    That's a very original use of comments!

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    An EXCEL-lent tip <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

    Steve

  3. #3
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Is it possible do do the above by means of a vba macro?? would save a lot of time - I just want to select a cell - run the macro and be able to choose a picture file from a standard popup file selection folder.
    Thanx
    smbs

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Here's a simple version. You can add error handling, more graphics file types, etc.

    Sub AddPictures()
    Dim i As Long
    Dim cmt As Comment
    Dim oCell As Range
    Dim varFile As Variant
    For i = ActiveSheet.Comments.Count To 1 Step -1
    Set cmt = ActiveSheet.Comments(i)
    If Not Intersect(cmt.Parent, Selection) Is Nothing Then
    cmt.Delete
    End If
    Next i
    For Each oCell In Selection.Cells
    varFile = Application.GetOpenFilename("Images,*.bmp;*.gif;*. jpg;*.png")
    If varFile = False Then
    ' skip this cell
    Else
    With oCell.AddComment
    .Visible = False
    .Shape.Fill.UserPicture PictureFile:=varFile
    End With
    End If
    Next oCell
    Set cmt = Nothing
    Set oCell = Nothing
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Many thanx
    Smbs

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add pictures to a comment! (Excel 2000 >)

    <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15> for this addition Hans! As Steve said before - EXCEL-lent!
    Regards,
    Rudi

  7. #7
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Yes I've done this before too, it's quite cool. You can also change the shape of the comment to one of the AutoShapes figures as well. Comments don't have to be dull white boxes <img src=/S/artist.gif border=0 alt=artist width=34 height=29>

    Deb

  8. #8
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add pictures to a comment! (Excel 2000 >)

    Hi Jujuraf...
    How do you change the shape of the comment to one of the AutoShapes figures and still retain the popup comment and red indicator. Is this something new?
    I created an autoshape and added a picture to it, but it is not a comment that pops up when the mouse moves over the cell. Can you convert a autoshape into a comment or can you change the shape of a comment to an autoshape???

    Please clarify your statement above!
    Regards,
    Rudi

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Use VBA:

    Range("A1").Comment.Shape.AutoShapeType = msoShapeWave

  10. #10
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add pictures to a comment! (Excel 2000 >)

    Well I never. It is interesting that code exists to do this and it cannot be done in the GUI !

    Makes you wonder what other secrets exists by using code to modify excel.

    Tx
    Regards,
    Rudi

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Excel has a "rich" VBA object model, unlike for example Outlook. There is no single recipe for finding out what can be done, you'll have to learn by experimenting. In this example, I looked up Comment in the Object Browser (press F2 to activate it), noticed that it has a Shape property, etc. You can also start to write code, using explicit declarations:

    Dim cmt As Comment

    If you then type cmt followed by a period. IntelliSense will pop up a list of properties and methods. Shape is among them. If you select that, then type a period again, IntelliSense will pop up another list, AutoShapeType among them.

  12. #12
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    You can do it in the GUI:
    1. Make sure the Drawing toolbar is visible.
    2.Show the comment and select it.
    3. On the drawing toolbar, choose Draw-Change autoshape and select your preference.
    Your comment will now have the selected shape.
    HTH.
    Regards,
    Rory

    Microsoft MVP - Excel

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Aha - learned something new! Thanks!

  14. #14
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Add pictures to a comment! (Excel 2000 >)

    Tx Rory...As Hans said...I learned something new!

    Thx Deb and Hans for the input too!
    Cheers
    Regards,
    Rudi

  15. #15
    Silver Lounger t8ntlikly's Avatar
    Join Date
    Dec 2001
    Location
    Chandler, AZ
    Posts
    2,162
    Thanks
    46
    Thanked 13 Times in 11 Posts

    Re: Add pictures to a comment! (Excel 2000 >)

    Awesome Tip, and just what I needed. I have a comparison spreadsheet, that has different products. We have our company's part number on it as well as the manufactures #. Now, by inserting these pictures there wont be any confusion.
    Thanks John
    Teamwork is essential; it gives the enemy other people to shoot at. (Murphy's War Laws #39)

Page 1 of 3 123 LastLast

Posting Permissions

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