Option Explicit
Sub InsertPictureComment1()
'Fill comment with fixed file
Dim sFileName As String
sFileName = "\\onedrive.ez.cloud-wp.nl@SSL\DavWWWRoot\personal\SijpJ\documents\Pictures\eon.jpg" ' "C:\Users\xxx\OneDrive\Pictures\bear.jpg"
With Range("E7").Comment.Shape.Fill
.Visible = True
.UserPicture sFileName
End With
End Sub
'or
Sub InsertPictureComment2()
'Fill comment with image to be picked
Dim vDlg As Variant
Dim x As Dialog
Dim sFileName As String
Set vDlg = Application.FileDialog(FileDialogType:=1)
vDlg.Show
sFileName = vDlg.SelectedItems(1)
With Range("E7").Comment.Shape.Fill
.Visible = True
.UserPicture sFileName
End With
End Sub
'or
Sub InsertPictureComment3()
' Gives a waiting screen...
Dim oDialog As Dialog
Dim strName As String
Set oDialog = Application.Dialogs(xlDialogInsertPicture)
With oDialog
.Show
'Insert Shape Picture if the Name property (Filepath) <> ""
If .Name <> "" Then
With Range("E7").Comment.Shape.Fill
.Visible = True
.UserPicture oDialog.Name
End With
End If
End With