ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Displayalerts = value (is not working for me) (https://www.excelbanter.com/excel-programming/319176-application-displayalerts-%3D-value-not-working-me.html)

[email protected]

Application.Displayalerts = value (is not working for me)
 
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.


Frank Kabel

Application.Displayalerts = value (is not working for me)
 
Hi
try using
thisworkbook.saved=true
before closing the application

--
Regards
Frank Kabel
Frankfurt, Germany
schrieb im Newsbeitrag
oups.com...
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.




AA2e72E

Application.Displayalerts = value (is not working for me)
 
Try:
Replace
Application.DisplayAlerts = False

By

ActiveWorkbook.Saved = True


" wrote:

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.



Dave Peterson[_5_]

Application.Displayalerts = value (is not working for me)
 
You have another response at your first post.

wrote:

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.


--

Dave Peterson


All times are GMT +1. The time now is 06:45 AM.

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