+ Reply to Thread
Results 1 to 3 of 3

Graphic within Cell Comment (revisited)

  1. #1
    No Spam
    Guest

    Graphic within Cell Comment (revisited)

    A couple of years ago some kind (and very clever) person posted the
    following code that allows me to paste a graphic within a cell
    comment. It works very, very well. I would like to know if it's
    possible to modify the code so it will take the graphic from the
    current content of the Windows clipboard instead of looking for a
    file?

    Thanks!

    /Lac/


    Sub PIC()

    Dim myPictureName As Variant

    myPictureName = Application.GetOpenFilename _
    (filefilter:="Picture
    Files,*.jpg;*.bmp;*.tif;*.gif")


    If myPictureName = False Then
    Exit Sub 'user hit cancel
    End If


    With ActiveCell
    'delete existing comments
    If .Comment Is Nothing Then
    'do nothing
    Else
    .Comment.Delete
    End If
    .AddComment
    With .Comment.Shape
    .Fill.Transparency = 0#
    .Line.Weight = 0.75
    .Line.DashStyle = msoLineSolid
    .Line.Style = msoLineSingle
    .Line.Transparency = 0#
    .Line.Visible = msoTrue
    .Line.ForeColor.RGB = RGB(0, 0, 0)
    .Line.BackColor.RGB = RGB(255, 255, 255)
    .Fill.Visible = msoTrue
    .Fill.ForeColor.RGB = RGB(255, 255, 255)
    .Fill.BackColor.SchemeColor = 80
    .Fill.UserPicture myPictureName
    End With
    End With

    End Sub

  2. #2
    Debra Dalgleish
    Guest

    Re: Graphic within Cell Comment (revisited)

    There's code here that will insert the selected picture into a comment
    in the active cell. You could modify it slightly, to paste the clipboard
    contents at the start of the code:

    http://www.contextures.com/xlcomments03.html#Picture

    No Spam wrote:
    > A couple of years ago some kind (and very clever) person posted the
    > following code that allows me to paste a graphic within a cell
    > comment. It works very, very well. I would like to know if it's
    > possible to modify the code so it will take the graphic from the
    > current content of the Windows clipboard instead of looking for a
    > file?
    >
    > Thanks!
    >
    > /Lac/
    >
    >
    > Sub PIC()
    >
    > Dim myPictureName As Variant
    >
    > myPictureName = Application.GetOpenFilename _
    > (filefilter:="Picture
    > Files,*.jpg;*.bmp;*.tif;*.gif")
    >
    >
    > If myPictureName = False Then
    > Exit Sub 'user hit cancel
    > End If
    >
    >
    > With ActiveCell
    > 'delete existing comments
    > If .Comment Is Nothing Then
    > 'do nothing
    > Else
    > .Comment.Delete
    > End If
    > .AddComment
    > With .Comment.Shape
    > .Fill.Transparency = 0#
    > .Line.Weight = 0.75
    > .Line.DashStyle = msoLineSolid
    > .Line.Style = msoLineSingle
    > .Line.Transparency = 0#
    > .Line.Visible = msoTrue
    > .Line.ForeColor.RGB = RGB(0, 0, 0)
    > .Line.BackColor.RGB = RGB(255, 255, 255)
    > .Fill.Visible = msoTrue
    > .Fill.ForeColor.RGB = RGB(255, 255, 255)
    > .Fill.BackColor.SchemeColor = 80
    > .Fill.UserPicture myPictureName
    > End With
    > End With
    >
    > End Sub



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


  3. #3
    No Spam
    Guest

    Re: Graphic within Cell Comment (revisited)

    Thanks! Lot's of good info at that site. I'm not good at VBA
    programming (better at cut & pasting!) but I will try to determine the
    necessary mods for the macro code.

    /Lac/

    On Sat, 28 Jan 2006 10:26:27 -0500, Debra Dalgleish
    <[email protected]> wrote:

    >There's code here that will insert the selected picture into a comment
    >in the active cell. You could modify it slightly, to paste the clipboard
    >contents at the start of the code:
    >
    > http://www.contextures.com/xlcomments03.html#Picture
    >
    >No Spam wrote:
    >> A couple of years ago some kind (and very clever) person posted the
    >> following code that allows me to paste a graphic within a cell
    >> comment. It works very, very well. I would like to know if it's
    >> possible to modify the code so it will take the graphic from the
    >> current content of the Windows clipboard instead of looking for a
    >> file?
    >>
    >> Thanks!
    >>
    >> /Lac/
    >>
    >>
    >> Sub PIC()
    >>
    >> Dim myPictureName As Variant
    >>
    >> myPictureName = Application.GetOpenFilename _
    >> (filefilter:="Picture
    >> Files,*.jpg;*.bmp;*.tif;*.gif")
    >>
    >>
    >> If myPictureName = False Then
    >> Exit Sub 'user hit cancel
    >> End If
    >>
    >>
    >> With ActiveCell
    >> 'delete existing comments
    >> If .Comment Is Nothing Then
    >> 'do nothing
    >> Else
    >> .Comment.Delete
    >> End If
    >> .AddComment
    >> With .Comment.Shape
    >> .Fill.Transparency = 0#
    >> .Line.Weight = 0.75
    >> .Line.DashStyle = msoLineSolid
    >> .Line.Style = msoLineSingle
    >> .Line.Transparency = 0#
    >> .Line.Visible = msoTrue
    >> .Line.ForeColor.RGB = RGB(0, 0, 0)
    >> .Line.BackColor.RGB = RGB(255, 255, 255)
    >> .Fill.Visible = msoTrue
    >> .Fill.ForeColor.RGB = RGB(255, 255, 255)
    >> .Fill.BackColor.SchemeColor = 80
    >> .Fill.UserPicture myPictureName
    >> End With
    >> End With
    >>
    >> End Sub


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1