Application.Displayalerts = value (is not working for me)

E

eagle13

Hi there,

I have some macro code that iniates upon workbook open below:
-------------------------------------------------------------------
Sub workbook_open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Worksheets("Error").Visible = xlVeryHidden
Application.Sheets("Sheet1").Select
If Now >= Worksheets("Error").Range("AO241") Then
Confirm = MsgBox("This workbook has expired. Please contact support
for further assistance.", vbInformation + vbOKOnly, "Workbook Expiry")
If Confirm = vbOKOnly Then
Application.DisplayAlerts = False
Application.Quit
Else:
Application.DisplayAlerts = False
Application.Quit
End If
Else:
Application.DisplayAlerts = False
End If
End Sub
-------------------------------------------------------------------

As you may notice from my many frustrating attempts (ie:
Application.Displayalerts = False), I am trying desperately to
*suppress* excel asking the user if they want to save when exiting. The
if/then statements in the middle of the above code works, however for
the other time when the if statements don't apply, excel just keeps
asking if I want to save! Can someone study the above code for me, and
tell me where App.Disp = False goes (if anywhere?)

Thank you muchly.
 
D

Dave Peterson

You have another response at your first post.

Hi there,

I have some macro code that iniates upon workbook open below:
-------------------------------------------------------------------
Sub workbook_open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Worksheets("Error").Visible = xlVeryHidden
Application.Sheets("Sheet1").Select
If Now >= Worksheets("Error").Range("AO241") Then
Confirm = MsgBox("This workbook has expired. Please contact support
for further assistance.", vbInformation + vbOKOnly, "Workbook Expiry")
If Confirm = vbOKOnly Then
Application.DisplayAlerts = False
Application.Quit
Else:
Application.DisplayAlerts = False
Application.Quit
End If
Else:
Application.DisplayAlerts = False
End If
End Sub
-------------------------------------------------------------------

As you may notice from my many frustrating attempts (ie:
Application.Displayalerts = False), I am trying desperately to
*suppress* excel asking the user if they want to save when exiting. The
if/then statements in the middle of the above code works, however for
the other time when the if statements don't apply, excel just keeps
asking if I want to save! Can someone study the above code for me, and
tell me where App.Disp = False goes (if anywhere?)

Thank you muchly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top