ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   suppress system msgs in excel 2k (https://www.excelbanter.com/excel-programming/317046-suppress-system-msgs-excel-2k.html)

dkyle

suppress system msgs in excel 2k
 
I've automated a timesheet process doing data collection via Access 2k,
building an excel 2k workbook via VBA containing individual timesheets
which are then printed.

I've used a .xlt template with one worksheet which I duplicate and rename
for each employee.

At the end I delete the templete worksheet, which pops up a Excel system msg
'the selected sheet(s) will be permanently deleted' with cmd btns 'ok or
cancel'...

The VB 'on error' keyword isn't being triggered as I have tried 'on error
resume next' or forcing an error handler and 'displayalerts = false' without
success.

Is there a way to redirect/control this system msg as it is rather confusing
to the end user.

Any suggestion would be greatly appreciated!

Thanks in advance. Doug



Jim Thomlinson[_3_]

suppress system msgs in excel 2k
 
application.DisplayAlerts = False
is the line of code that you are looking for. Turn alerts off at the
beginning of the procedure and back on again at the end. When you use
something like this is is a good idea to add in some error handling to turn
the alerts back on in case an error occures.

sub whatever
on error goto ErrorHandler
'do some stuff
...
application.DisplayAlerts = true
Exit Sub
ErrorHandler:
application.DisplayAlerts = true
end sub

Hope this helps...
"dkyle" wrote:

I've automated a timesheet process doing data collection via Access 2k,
building an excel 2k workbook via VBA containing individual timesheets
which are then printed.

I've used a .xlt template with one worksheet which I duplicate and rename
for each employee.

At the end I delete the templete worksheet, which pops up a Excel system msg
'the selected sheet(s) will be permanently deleted' with cmd btns 'ok or
cancel'...

The VB 'on error' keyword isn't being triggered as I have tried 'on error
resume next' or forcing an error handler and 'displayalerts = false' without
success.

Is there a way to redirect/control this system msg as it is rather confusing
to the end user.

Any suggestion would be greatly appreciated!

Thanks in advance. Doug




Jim Thomlinson[_3_]

suppress system msgs in excel 2k
 
Sorry. Just before do some stuff I meant to include
application.DisplayAlerts = False

"Jim Thomlinson" wrote:

application.DisplayAlerts = False
is the line of code that you are looking for. Turn alerts off at the
beginning of the procedure and back on again at the end. When you use
something like this is is a good idea to add in some error handling to turn
the alerts back on in case an error occures.

sub whatever
on error goto ErrorHandler
'do some stuff
...
application.DisplayAlerts = true
Exit Sub
ErrorHandler:
application.DisplayAlerts = true
end sub

Hope this helps...
"dkyle" wrote:

I've automated a timesheet process doing data collection via Access 2k,
building an excel 2k workbook via VBA containing individual timesheets
which are then printed.

I've used a .xlt template with one worksheet which I duplicate and rename
for each employee.

At the end I delete the templete worksheet, which pops up a Excel system msg
'the selected sheet(s) will be permanently deleted' with cmd btns 'ok or
cancel'...

The VB 'on error' keyword isn't being triggered as I have tried 'on error
resume next' or forcing an error handler and 'displayalerts = false' without
success.

Is there a way to redirect/control this system msg as it is rather confusing
to the end user.

Any suggestion would be greatly appreciated!

Thanks in advance. Doug





All times are GMT +1. The time now is 03:47 AM.

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