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!

[1151 byte] By [suznal] at [2008-1-9]
# 1

Code Snippet

If PicLocation <> "False" Then

bi-lya at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...
# 2

Thank you!

You have no idea how many times I looked at it, (and how stupid I feel)!

I think I need a vacation!

suznal at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...