A couple of options, if you want to simply close the workbook without saving, run this line:
windows("Nameof File.xls").close savechanges:=false
This is One line of Code. it may appear as two on this viewer.
to close excel use
windows.application.quit
Rob
Thanks Rob on your reply and suggestions. However, still in a bit of bother.
"windows("Nameof File.xls").close savechanges:=false"
works fine but still leaves Exel open.
"windows.application.quit"
works fine also but still brings up a prompt asking if the file wants to be saved.
I tried putting the two lines together in the one macro but of course that didn't work as once the workbook is closed the macro is as well.
Also I tried putting
"savechanges:=false"
at the end of "Quit". All I get then was an error message.
What I have, to give you an idea what I need, is a MS Powerpoint presentation (a workplace induction) with a link on the last screen to an Excel file. This file is simply where the inductee puts his/her name and details on a form which is then printed out for documentary evidence. On completion of that the file is shut down without saving thus not requiring a supervisor to shut it down.
A fairly long winded post but I hope you may further help me in this.
Many t i a
TR
Sub macrorequired()
ActiveWorkbook.Saved = True ' cancels any changes
Windows.Application.Quit ' closes wkbk & excel
End Sub
This should work if you only have the one workbook open.