Sace and close

  • Thread starter Thread starter ianripping
  • Start date Start date
I

ianripping

I want to have a macro assigned to a button so that when the button is
pressed the current file is saved and then excel is exited.

I tried: -

Sub Closea()
ThisWorkbook.Save
Application.Select.Close
End Sub

But no good. Saving works but not close.

Sub Closea()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub

Will close the workbook but not excel itself.
Any ideas?
 
ianripping said:
I want to have a macro assigned to a button so that when the button is
pressed the current file is saved and then excel is exited.

I tried: -

Sub Closea()
ThisWorkbook.Save
Application.Select.Close
End Sub

But no good. Saving works but not close.

To close use Application.Quit

Regards,
 
OK Brilliant this works fine, is it possible to make excel save change
to all open workbooks instead of: -

ThisWorkbook.Sav
 
Back
Top