Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Force sort before worksheet exit | Excel Worksheet Functions | |||
Force a Readonly Workbook to save to a different folder | Excel Discussion (Misc queries) | |||
Macro: Exit active workbook without save? | Excel Worksheet Functions | |||
Save & Exit | Excel Worksheet Functions | |||
auto save on exit while at the same time rename workbook... | Excel Programming |