error 1004 - unable to get insert property of the pictures class
I have some code that works behind a command button to insert a selected image file into a cell on a worksheet. If the user clicks the 'Cancel' button on the 'getfilenamesaveas' window an error message displays...
"Error 1004 - Unable to get Insert Propeerty of the Pictures Class"
Am I missing something in the code? (see below)
Private Sub CommandButton1_Click()
Range("A6").Select
Dim PicLocation As String
PicLocation = Application.GetSaveAsFilename("C:\Windows\My Documents", "Image Files (*.jpg),*.jpg", , "Specify Image Location")
If PicLocation <> "" Then
ActiveSheet.Pictures.Insert(PicLocation).Select
Else
Exit Sub
End If
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Width = 235#
Selection.ShapeRange.Height = 165#
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
Range("H16").Select
End Sub
Any help would be greatly appreciated!

