Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i cancel user restricted values in a cell grahamcotton New Users to Excel 1 August 14th 08 05:15 PM
allow user to disable annoying warning dialog on log charts Roger Charts and Charting in Excel 3 September 13th 05 01:26 PM
Dialog & User Form bach New Users to Excel 2 August 13th 05 09:35 PM
Macro to pause for user input in dialog box kayabob Excel Discussion (Misc queries) 1 June 22nd 05 07:49 PM
How do I check if a user clicked the Print Cancel button joanne Excel Programming 0 September 5th 03 08:24 AM


All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"