ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Force no save on workbook exit (https://www.excelbanter.com/excel-programming/319128-force-no-save-workbook-exit.html)

R A

Force no save on workbook exit
 
Hello

I have the following macro code performing a bit of a dance with sheets
in a workbook, and doing some date validation along the way. The code
works fine, however what I thought was supposed to be working is the
command to disable excel asking the user if they want to save:
----------------------------------------------------------
Sub workbook_open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Application.Sheets("Sheet1").Select
Call Hide_Error
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.Quit
Else: Application.Quit
End If
End If
Me.Saved = True
End Sub
----------------------------------------------------------

Doesn't 'Me.Saved = True' do this?
Basically I want stop excel putting up a dialogue asking the user do
they want to save. Any suggestions on how I may be able to do this?

Thankyou.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Frank Kabel

Force no save on workbook exit
 
Hi
application.displayalerts=false

--
Regards
Frank Kabel
Frankfurt, Germany
"R A" schrieb im Newsbeitrag
...
Hello

I have the following macro code performing a bit of a dance with sheets
in a workbook, and doing some date validation along the way. The code
works fine, however what I thought was supposed to be working is the
command to disable excel asking the user if they want to save:
----------------------------------------------------------
Sub workbook_open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Application.Sheets("Sheet1").Select
Call Hide_Error
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.Quit
Else: Application.Quit
End If
End If
Me.Saved = True
End Sub
----------------------------------------------------------

Doesn't 'Me.Saved = True' do this?
Basically I want stop excel putting up a dialogue asking the user do
they want to save. Any suggestions on how I may be able to do this?

Thankyou.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Jared

Force no save on workbook exit
 
Thisworkbook.Saved=True will also work.

"Frank Kabel" wrote:

Hi
application.displayalerts=false

--
Regards
Frank Kabel
Frankfurt, Germany
"R A" schrieb im Newsbeitrag
...
Hello

I have the following macro code performing a bit of a dance with sheets
in a workbook, and doing some date validation along the way. The code
works fine, however what I thought was supposed to be working is the
command to disable excel asking the user if they want to save:
----------------------------------------------------------
Sub workbook_open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Application.Sheets("Sheet1").Select
Call Hide_Error
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.Quit
Else: Application.Quit
End If
End If
Me.Saved = True
End Sub
----------------------------------------------------------

Doesn't 'Me.Saved = True' do this?
Basically I want stop excel putting up a dialogue asking the user do
they want to save. Any suggestions on how I may be able to do this?

Thankyou.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!






All times are GMT +1. The time now is 11:51 PM.

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