MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Delete open workbook

  Asked By: Lucina    Date: Feb 18    Category: MS Office    Views: 1942

I have the following task to do:

1. From a template I make pre-filled testcertificate as workbook
2. Test people opens the workbook and fill out with testresults
3. Workbook is saved as pdf
4. Workbook is deleted

I would like 3. and 4. to be made from a commandbutton in the
workbook, but can't think of how to delete the open workbook from

Can anyone give me a clue ?



2 Answers Found

Answer #1    Answered By: Alok Iit     Answered On: Feb 18

If the workbook  has never been saved as an xls file then closing it
without saving it means it won't exist and so it will not have to be
The following vba code should quit excel completely:

Application.DisplayAlerts = False

This next bit should close a workbook without saving:

Workbooks("BOOK1.XLS").Close SaveChanges:=False

or if you don't know the name of the workbook:

Thisworkbook.Close SaveChanges:=False

Answer #2    Answered By: Lucinda Hall     Answered On: Feb 18

I read it as it is not possible to delete  the workbook  from inside
itself (as it has been saved - so it can be used by testpeople)

Solution must be to control the task  from another workbook, and fx. use
the Kill statement.

Didn't find what you were looking for? Find more on Delete open workbook Or get search suggestion and latest updates.