Dialog Box - User hits cancel
Range("F3").Select
If Application.Dialogs(xlDialogInsertPicture).Show Then
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 225#
Selection.ShapeRange.Width = 300#
End If
Range("F23").Select
If Application.Dialogs(xlDialogInsertPicture).Show Then
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 225#
Selection.ShapeRange.Width = 300#
End If
The dialog returns false if the user presses cancel.
--
Regards,
Tom Ogilvy
"CS" wrote in message
...
Here is my code....
Sub InsertPictures()
Application.ScreenUpdating = False
Range("F3").Select
Application.Dialogs(xlDialogInsertPicture).Show
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 225#
Selection.ShapeRange.Width = 300#
Range("F23").Select
Application.Dialogs(xlDialogInsertPicture).Show
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 225#
Selection.ShapeRange.Width = 300#
Application.ScreenUpdating = True
ActiveWorkbook.Close (True)
End Sub
"Michael Hopwood" wrote in message
...
You need to trap the error and deal with it.
Post your code.
--
Michael Hopwood (Phobos)
"CS" wrote in message
...
I have a dialog box for inserting an image that pops up in my macro -
if
the
user presses cancel - an error is reported (method not supported) how
can
I
suppress this error?
Can I use some code like - if cancel is pressed exit sub?
Thanks,
Colin
|