PDA

Click to See Complete Forum and Search --> : closing excel application


sweet_dreams
Nov 14th, 2005, 11:24 AM
hi all,

Can you tell me how can I programatically close active excel application???

thx in advance for your help

regards,
sweet_dreams

malik641
Nov 14th, 2005, 11:32 AM
Well if you know the workbook's name:
Sub CloseExcel()
Application.Workbooks("Book2").Close
End Sub
Or if you send the Procedure the name:
Sub CloseExcel(wb As Workbook)
Application.Workbooks(wb.Name).Close
End Sub

Hope this is what you were looking for :thumb:

malik641
Nov 14th, 2005, 11:40 AM
Oh yeah, and to close all workbooks (without saving)
Sub CloseExcel()
With Application
.EnableEvents = False
.Workbooks.Close
.EnableEvents = True
End With
End Sub

sweet_dreams
Nov 14th, 2005, 11:59 AM
thx malik641 but I was looking for something else. I was looking for something like that:

application.quite

code above closes whole excel application

but thx anyway

malik641
Nov 14th, 2005, 12:16 PM
I thought there was an easier way.

Glad to see you got it moving.