Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automating key strokes to a dialog box

I am running a simple macro where I need to delete a worksheet named
"Pivot", using the following code in VBA:

Sheets("Pivot").Delete

However, when I run this, I get a dialog box within Excel that reads:

"Data may exist in the sheet(s) selected for deletion. To permanently
delete the data, press delete"

The dialog box has two buttons "Delete" (which is active) and "Cancel".

Is there a way that I can automate the pressing of the delete button so
that the end user doesn't have to respond to the dialog box?

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Automating key strokes to a dialog box

Set the DisplayAlerts to False before you do the delete, then restore it to
true after the delete. E.g.,

Application.DisplayAlerts = False
Sheets("Pivot").Delete
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Scott G" wrote in message
oups.com...
I am running a simple macro where I need to delete a worksheet named
"Pivot", using the following code in VBA:

Sheets("Pivot").Delete

However, when I run this, I get a dialog box within Excel that reads:

"Data may exist in the sheet(s) selected for deletion. To permanently
delete the data, press delete"

The dialog box has two buttons "Delete" (which is active) and "Cancel".

Is there a way that I can automate the pressing of the delete button so
that the end user doesn't have to respond to the dialog box?

Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automating key strokes to a dialog box

Thanks Chip, that worked perfectly!


Chip Pearson wrote:
Set the DisplayAlerts to False before you do the delete, then restore it to
true after the delete. E.g.,

Application.DisplayAlerts = False
Sheets("Pivot").Delete
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Scott G" wrote in message
oups.com...
I am running a simple macro where I need to delete a worksheet named
"Pivot", using the following code in VBA:

Sheets("Pivot").Delete

However, when I run this, I get a dialog box within Excel that reads:

"Data may exist in the sheet(s) selected for deletion. To permanently
delete the data, press delete"

The dialog box has two buttons "Delete" (which is active) and "Cancel".

Is there a way that I can automate the pressing of the delete button so
that the end user doesn't have to respond to the dialog box?

Thanks in advance.


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
Slow Respone to key strokes Keith Excel Discussion (Misc queries) 4 December 6th 07 12:08 AM
Slow respone to key strokes Keith Excel Discussion (Misc queries) 1 December 5th 07 11:59 PM
Is there a way to move between worksheets using key strokes only? John Parker Excel Discussion (Misc queries) 3 December 30th 06 12:16 AM
How do I repeat key strokes in Excel? ross_76102 Excel Programming 6 April 26th 05 03:22 AM
How can I activate a combobox by keyboard strokes ? Oscar Excel Programming 11 January 4th 04 04:25 AM


All times are GMT +1. The time now is 12:05 PM.

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

About Us

"It's about Microsoft Excel"