Code: Select all
Set Pic = Me.Pictures.Insert(PicLocation)
Here is the complete code
Code: Select all
Sub RunPicture(control As IRibbonControl)
Dim Pic As Excel.Picture
Dim PicLocation As String
Dim MyRange As Range
PicLocation = Application.GetOpenFilename(FileFilter:="Pic Files (*.jpg;*.bmp), *.jpg;*.bmp", Title:="Browse to select a picture")
If PicLocation = "False" Then Exit Sub
Set Pic = Me.Pictures.Insert(PicLocation)
With Pic.ShapeRange
.Left = ActiveCell.Left
.Top = ActiveCell.Top
.Width = 100
.Height = 100
.LockAspectRatio = msoFalse
End With
End Sub