Try something like this...
Sub Rectangle1_Click()
Dim fileToOpen As Variant, rng As Range
fileToOpen = Application _
.GetOpenFilename("All Picture Files (*.jpg;*.gif;*.bmp;*.tif),*.jpg;*.gif;*.bmp;*.tif")
If fileToOpen <> False Then
Set rng = Sheets("Sheet1").Range("A1")
With rng.Parent.Pictures.Insert(fileToOpen)
.Name = "newPic A1"
.Left = rng.Left
.Top = rng.Top
.Width = rng.Width
.Height = rng.Height
End With
Else
Unload Me
End If
If MsgBox("Do you want to insert a 2nd picture? ", vbQuestion + vbYesNo, "Insert Another Pic") = vbYes Then
fileToOpen = Application _
.GetOpenFilename("All Picture Files (*.jpg;*.gif;*.bmp;*.tif),*.jpg;*.gif;*.bmp;*.tif")
If fileToOpen <> False Then
Set rng = Sheets("Sheet1").Range("A2")
With rng.Parent.Pictures.Insert(fileToOpen)
.Name = "newPic A2"
.Left = rng.Left
.Top = rng.Top
.Width = rng.Width
.Height = rng.Height
End With
End If
End If
Unload Me
End Sub
Bookmarks