View Full Version : supress display warnings
austenr
11-08-2006, 01:40 PM
I have code in an Access module that deletes sheets in an excel workbook at the end of the sub. Is there a way to suppress the conformation of deleting the sheet with VBA code?
johnske
11-08-2006, 02:55 PM
Use Application.DisplayAlerts = False before deleting the sheets and set it back to true after :)
malik641
11-08-2006, 03:00 PM
Use Application.DisplayAlerts = False before deleting the sheets and set it back to true after :)
Do you have to use the Excel object for the application, or is it across the board?
Ken Puls
11-08-2006, 03:12 PM
The alert will be thrown by Excel, not Access, so you'd have to use the Excel object.
malik641
11-08-2006, 03:18 PM
That's what I thought. Thanks Ken :)
austenr
11-09-2006, 07:57 AM
What is the correct syntax for that? I tried something along those lines but it didn't seem to work. Thanks guys and congrats Ken just read about your MVP status.:thumb
malik641
11-09-2006, 08:19 AM
What do you have now?
All you need to do is use your excel application variable in place of "Application" from John's post..like if xlApp is the variable...
Sub Testme()
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
' Check
Debug.Print xlApp.DisplayAlerts
' Reset
xlApp.DisplayAlerts = True
'Check Again
Debug.Print xlApp.DisplayAlerts
' Clean up
Set xlApp = Nothing
End Sub
Hope this helps :thumb
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.