Hi All!
I have set up a macro to create a comment and insert a background picture. The issue is that I cannot figure out how to make the comment box the size of the original picture. Since the inserted picture will be different each time, I need it to resize automatically. I have been searching for answers all afternoon, but none of the resizing code I've seen address this situation. Here's what I have so far:
Sub ImageComment()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False 'Only one file
.InitialFileName = CurDir 'directory to open the window
.Filters.Clear 'Cancel the filter
.Filters.Add Description:="Images", Extensions:="*.jpg", Position:=1
.Title = "Choose image"
If .Show = -1 Then TheFile = .SelectedItems(1) Else TheFile = 0
End With
'No file selected
If TheFile = 0 Then
MsgBox ("No image selected")
Exit Sub
End If
ActiveCell.AddComment
ActiveCell.Comment.Visible = True
[ActiveCell].Comment.Shape.Fill.UserPicture TheFile
End Sub
Any suggestions?
Bookmarks