![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 18
|
Hi all
I have a command button that closes the active workbook and activates another workbook that is already open.... Private Sub CommandButton1_Click() ActiveWorkbook.Close Windows("Database.xls").Activate End Sub When this button is clicked the user may be asked if they wish to save changes. I dont want them too. Is it possible for a worksheet to NOT ask "Do you wish to save changes?" when it is closed (i.e when this command button is clicked)?? and only save changes when they File-Save..... Thanks for your time. |
|
|
|
|
|
#2 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
Just use this code (please use like below: i changed the ActiveWorkbook.Close line place, it should better located as the last command line.
Private Sub CommandButton1_Click() Windows("Database.xls").Activate 'Next line does what you need Workbooks("name or index").Saved = True ActiveWorkbook.Close End Sub Regards _________________ Oz ~ TheWordExpert [ This Message was edited by: smozgur on 2002-04-03 07:08 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Posts: 113
|
Try this:
ActiveWorkbook.Close SaveChanges:=False |
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Posts: 18
|
Thank you both.
May the luck be with you.... |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|