What is the code to close Excel ,or can't one close excel with code? I can close the workbook but would like to close the program.
Here is my code for a book.......[VBA]ActiveWorkbook.Close ("WB name..xls")[/VBA]
Any help please.
What is the code to close Excel ,or can't one close excel with code? I can close the workbook but would like to close the program.
Here is my code for a book.......[VBA]ActiveWorkbook.Close ("WB name..xls")[/VBA]
Any help please.
Hi its
[VBA]
Application.Quit
[/VBA]I think!
Regards,
Simon
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Thanx but that only closes the workbook not excel.
The below is from here http://www.contextures.com/xlfaqMac.html#CloseRegards,
How do I close a file/close Excel with a macro?
ActiveWorkbook.Close savechanges:=False 'true ??? --will close the active workbook Workbooks("mywkbk.xls").Close savechanges:=False 'true ??? --will close mywkbk.xls ThisWorkbook.Close savechanges:=False 'true ??? --will close the workbook that holds the code that's running. Application.Quit will close all of Excel. --Be careful with this one.
SImon
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
A ha..... just had put it in the right place
Thanx Simon.
[VBA]Private Sub CommandButton1_Click()
Application.DisplayAlerts = False
Application.Quit
End Sub[/VBA]
I use this. As Simon points out be careful as it closes without saving changes.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Thanx all