Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I am trying to create code for a commandbutton on a userform which will close the workbook without saving. Using <Application.quit throws up a message box giving the user a choice (which I do not want!) Is there something similar to <ThisWorkbook.Save (but obviously does not save!) Thanks Kenny |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kenny,
Use something like ThisWorkbook.Close SaveChanges:=False -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newbie1" wrote in message ... Hello I am trying to create code for a commandbutton on a userform which will close the workbook without saving. Using <Application.quit throws up a message box giving the user a choice (which I do not want!) Is there something similar to <ThisWorkbook.Save (but obviously does not save!) Thanks Kenny |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Chip
Still not quite what I wanted! I used Private Sub CommandButton3_Click() ThisWorkbook.Close SaveChanges:=False Application.Quit End Sub However the file closed but left the Excel menu bar on the screen which I had to close manually. When I use:- (on another button) Sub ChooseNo() Unload UserForm2 ThisWorkbook.Save Application.Quit End Sub Excel closes completely - This is what I am trying to achieve - any ideas what I am doing wrong? Kenny "Chip Pearson" wrote in message ... Kenny, Use something like ThisWorkbook.Close SaveChanges:=False -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newbie1" wrote in message ... Hello I am trying to create code for a commandbutton on a userform which will close the workbook without saving. Using <Application.quit throws up a message box giving the user a choice (which I do not want!) Is there something similar to <ThisWorkbook.Save (but obviously does not save!) Thanks Kenny |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When the workbook closes, the code stops, so you never hit quit
In your second example, you don't close the workbook, you just save it. try this Private Sub CommandButton3_Click() ThisWorkbook.Saved=True Application.Quit End Sub Setting Saved = True should tell Excel the workbook does not need to be saved and it should close without prompting. -- Regards, Tom Ogilvy "Newbie1" wrote in message ... Hello Chip Still not quite what I wanted! I used Private Sub CommandButton3_Click() ThisWorkbook.Close SaveChanges:=False Application.Quit End Sub However the file closed but left the Excel menu bar on the screen which I had to close manually. When I use:- (on another button) Sub ChooseNo() Unload UserForm2 ThisWorkbook.Save Application.Quit End Sub Excel closes completely - This is what I am trying to achieve - any ideas what I am doing wrong? Kenny "Chip Pearson" wrote in message ... Kenny, Use something like ThisWorkbook.Close SaveChanges:=False -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newbie1" wrote in message ... Hello I am trying to create code for a commandbutton on a userform which will close the workbook without saving. Using <Application.quit throws up a message box giving the user a choice (which I do not want!) Is there something similar to <ThisWorkbook.Save (but obviously does not save!) Thanks Kenny |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom
Exactly what I wanted - Thanks Kenny (Newbie1) "Tom Ogilvy" wrote in message ... When the workbook closes, the code stops, so you never hit quit In your second example, you don't close the workbook, you just save it. try this Private Sub CommandButton3_Click() ThisWorkbook.Saved=True Application.Quit End Sub Setting Saved = True should tell Excel the workbook does not need to be saved and it should close without prompting. -- Regards, Tom Ogilvy "Newbie1" wrote in message ... Hello Chip Still not quite what I wanted! I used Private Sub CommandButton3_Click() ThisWorkbook.Close SaveChanges:=False Application.Quit End Sub However the file closed but left the Excel menu bar on the screen which I had to close manually. When I use:- (on another button) Sub ChooseNo() Unload UserForm2 ThisWorkbook.Save Application.Quit End Sub Excel closes completely - This is what I am trying to achieve - any ideas what I am doing wrong? Kenny "Chip Pearson" wrote in message ... Kenny, Use something like ThisWorkbook.Close SaveChanges:=False -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newbie1" wrote in message ... Hello I am trying to create code for a commandbutton on a userform which will close the workbook without saving. Using <Application.quit throws up a message box giving the user a choice (which I do not want!) Is there something similar to <ThisWorkbook.Save (but obviously does not save!) Thanks Kenny |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
close without saving | Excel Discussion (Misc queries) | |||
close w/o saving | Excel Worksheet Functions | |||
VBA - Close without saving changes | Excel Discussion (Misc queries) | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel |