Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog Box - User hits cancel
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog Box - User hits cancel
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog Box - User hits cancel
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dialog Box - User hits cancel
Worked a treat - thanks!
Colin "Tom Ogilvy" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i cancel user restricted values in a cell | New Users to Excel | |||
allow user to disable annoying warning dialog on log charts | Charts and Charting in Excel | |||
Dialog & User Form | New Users to Excel | |||
Macro to pause for user input in dialog box | Excel Discussion (Misc queries) | |||
How do I check if a user clicked the Print Cancel button | Excel Programming |