Alerts disabled in DoEvents loop - Deletion of protected-locked ce

P

Potter

When running a macro that includes a loop with DoEvents alert messages are
not shown to the user. In my case locked cells of protected Worksheets do
not allow data entry but do not alert the user as to why. Even more
problematic the content of these protected cells are delete when the delete
key is pressed! This does not occur if the macro is not running. Instead an
alert dialog is displayed and the action is cancelled.

The problem can be reproduced with the following steps:
1. Create a Workbook and set all cells in a Worksheet to locked
2. Enter values into some of the cells
3. Protect the Worksheet
4. Select a cell and press delete (alert message should be shown)
5. Run a macro with a doevents loop
6. While the loop is running select a cell and press delete (contents are
removed and no alert is shown!)

example macro (runs a doevents loop for 2 minutes):
Sub executeDoEvents()
Application.DisplayAlerts = True
For i = 1 To 1200
Sleep (100)
DoEvents
Next i


MsgBox "Done executing DoEvents"

End Sub
 
H

Harlan Grove

Potter said:
The problem can be reproduced with the following steps:
1. Create a Workbook and set all cells in a Worksheet to locked

They should all be locked by default.
2. Enter values into some of the cells
3. Protect the Worksheet
4. Select a cell and press delete (alert message should be shown)
Confirmed.

5. Run a macro with a doevents loop
6. While the loop is running select a cell and press delete (contents are
removed and no alert is shown!)

Not on my machine. There's no message displayed, but cells contents
aren't deleted either.
 
P

Potter

Thanks for the feedback. It would be a big step forward to get the behavior
you see.

I'm using Excel 2003 (11.8.142.8132) SP2

What version of Excel did you try this with?
 
P

Potter

The deletion behavior appear to be tied to macro security. With security set
to 'Low' Excel allows deletion of protected-locked cells (while in DoEvents
loop). With 'Medium' security this is not the case (although no alert is
displayed). It appears that user actions that are processed during the
DoEvents loop are executed using the security rights of the macro. Is there
any way around this?
 
H

Harlan Grove

Potter said:
Thanks for the feedback.  It would be a big step forward to get the
behavior you see.

I'm using Excel 2003 (11.8.142.8132) SP2

What version of Excel did you try this with?
....

Excel 2003 SP1
 
S

Sandy Mann

Harlan Grove said:
Not on my machine. There's no message displayed, but cells contents
aren't deleted either.
No they wouldn't dare Harlan <G>

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top