G
Guest
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
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