ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable warning messages? (https://www.excelbanter.com/excel-programming/315431-disable-warning-messages.html)

Ed Ardzinski[_2_]

disable warning messages?
 
I have written a few macro's recently that take the output from Access
queries and copy the data into template spreadsheets. Depending on how large
a block of data is copied the user might get a warning about keeping the data
available to other applications on the clipboard...also get a warning when
the macro deletes some sheets from the workbook.

In Access I can turn these sorts of warnings on an off. Is there a similar
way to prevent these "breakpoints" where the user has to input a choice?

TIA

Ed Ardzinski[_2_]

disable warning messages?
 
Please disregard...figured it out!

ManualMan

disable warning messages?
 
Yep!

Application.DisplayAlerts = False

....your code

Application.DisplayAlerts = True

This will only disable workbook-related dialogs (Save / Discard, etc).
Errordialogs generated because of misprogramming etc require a more
solid error handling. Try googling "error handling syntax vba"
Manual Man


ManualMan

disable warning messages?
 
Hi,

Had some problems posting this one, hope there aren't 2 answers. This
does the trick

Sub something()
Application.DisplayAlerts = False
-- some code
Application.DisplayAlerts = True
End Sub

Note: This will only prevent the usual Excel dialogs from appearing.
Error dialogs generated from VBA because of misprogramming should be
catched by more solid error handling (try "error handling syntax vba"
on google)

Regards,
ManualMan



All times are GMT +1. The time now is 08:56 AM.

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