![]() |
![]() |
|
|||||||
| 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: Apr 2002
Posts: 26
|
Hi,
I have a form which I am using to update a workbook, I have a cmdbutton which adds the record and asks if the user wants to add another record. If the answer is No, the user is asked if the entry is the last entry for the week. If the answer is YES then the workbook is saved as wkbook1-date.xls. What I can't figure out is How do I close the initial workbook and clear all the data from the worksheet if the entry is the last for the week. Can anyone help me? Thanks, Mareene [ This Message was edited by: camalita on 2002-04-30 08:59 ] |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
So, you've got the message box with the yes-no buttons nailed down. To close the active workbook with no save try:
Code:
thisworkbook.close false Code:
sheet1.[a1].clearcontents However, if you don't save the changes (clearing the contents) the workbook won't be saved. Code to save (assuming the path and name already exist) is: Code:
thisworkbook.save http://www.mrexcel.com/board/viewtop...c=6703&forum=2 Hope this helps. _________________ Cheers, NateO [ This Message was edited by: NateO on 2002-04-30 09:53 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|