View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Displayalerts not working

Hi Hari,

Try runnining this small demo:

Sub Tester()
Debug.Print "Opening State", Application.DisplayAlerts
DisplayAlerts = False
Debug.Print "After DisplayAlerts = False command", _
Application.DisplayAlerts

DisplayAlerts = True
Debug.Print "Closing State", Application.DisplayAlerts

End Sub

The immediate window reports:


Opening State True
After DisplayAlerts = False command True
Closing State True

As you see, if DisplayAlerts is used without the required Application
qualifier, no error is observed but neither is any response.

That is why Excel was throwing up the overwrite alert message. If you rerun
the code (using the qualified construct), no alert should be observed.

For the record, I have not run your code or otherwise examined it. I did,
however, run a test repoducing a file overwrite event.

---
Regards,
Norman



"Hari" wrote in message
...
Hi Norman,

Just from understanding point of view....

When I previously wrote it as -- DisplayAlerts = True -- how does excel
interpret the statement. Is NOT writing Application. NOT considered as an
error. Does that mean DisplayAlerts = True is also a valid statement on
its
own and if so what does it do.

Thanks a lot,
Hari
India

"Norman Jones" wrote in message
...
Hi Hari,

Just to add, you would similarly need to amend the closing:

DisplayAlerts = True


to

Application. DisplayAlerts = True


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Hari,

Try changing:


DisplayAlerts = False

to

Application. DisplayAlerts = False


---
Regards,
Norman