Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default DisplayAlerts not working?

Hi,
Can someone possibly explain what's happening with this:
Worksheets(1).Delete
Application.DisplayAlerts = False

This appears to work on occasions - as in, I have the same piece of code
several places, and some of the sheets are deleted without confirmation, some
need confirmation. Anyone any ideas why this is happening?

Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default DisplayAlerts not working?

You need to turn alerts off prior to the code that will generate the alert
and then be darned sure to turn it back on again when the code completes...

Application.DisplayAlerts = False
Worksheets(1).Delete
Application.DisplayAlerts = True

--
HTH...

Jim Thomlinson


"Aaron" wrote:

Hi,
Can someone possibly explain what's happening with this:
Worksheets(1).Delete
Application.DisplayAlerts = False

This appears to work on occasions - as in, I have the same piece of code
several places, and some of the sheets are deleted without confirmation, some
need confirmation. Anyone any ideas why this is happening?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default DisplayAlerts not working?

Switch the order:
Application.DisplayAlerts = False
Worksheets(1).Delete

"Aaron" wrote in message
...
Hi,
Can someone possibly explain what's happening with this:
Worksheets(1).Delete
Application.DisplayAlerts = False

This appears to work on occasions - as in, I have the same piece of code
several places, and some of the sheets are deleted without confirmation,

some
need confirmation. Anyone any ideas why this is happening?

Thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default DisplayAlerts not working?

Ah thanks, that would explain why it works sometimes and not others as well!

"Jim Thomlinson" wrote:

You need to turn alerts off prior to the code that will generate the alert
and then be darned sure to turn it back on again when the code completes...

Application.DisplayAlerts = False
Worksheets(1).Delete
Application.DisplayAlerts = True

--
HTH...

Jim Thomlinson


"Aaron" wrote:

Hi,
Can someone possibly explain what's happening with this:
Worksheets(1).Delete
Application.DisplayAlerts = False

This appears to work on occasions - as in, I have the same piece of code
several places, and some of the sheets are deleted without confirmation, some
need confirmation. Anyone any ideas why this is happening?

Thanks



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
DisplayAlerts = false not working Mark Stephens Excel Programming 4 June 13th 05 06:05 AM
Displayalerts not working Hari[_3_] Excel Programming 11 January 14th 05 06:13 PM
Application.Displayalerts = value (is not working for me) [email protected] Excel Programming 3 December 18th 04 02:00 AM
application.displayalerts is not working will lam Excel Programming 2 April 30th 04 08:21 PM
Application::DisplayAlerts not working Howard Dierking Excel Programming 2 February 11th 04 12:04 PM


All times are GMT +1. The time now is 10:24 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"