ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turn display alerts off then back on at close (https://www.excelbanter.com/excel-programming/411454-turn-display-alerts-off-then-back-close.html)

J.W. Aldridge

Turn display alerts off then back on at close
 
- on open, i need to turn all automated display alerts off.
- then give my own alert (informing whomever opens the workbook how to
change security level in order to run macros)
- on close, cancel the alert 'do you want to save changes' message,
- but turn display alerts back on.


JNW

Turn display alerts off then back on at close
 
'to turn off
application.displayalerts = false

'to turn on
application.displayalerts = true

The only problem is you cannot run macros until the user has turned them on.
Chicken before the egg kind of problem.

What I usually do instead is on the workbook_beforeclose event I'll activate
an instruction sheet then save the file. This will show the instructions on
the next open of the file and the user can then follow to turn on macros.

"J.W. Aldridge" wrote:

- on open, i need to turn all automated display alerts off.
- then give my own alert (informing whomever opens the workbook how to
change security level in order to run macros)
- on close, cancel the alert 'do you want to save changes' message,
- but turn display alerts back on.




All times are GMT +1. The time now is 02:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com