To the end of my code i need to close Excel...
i use:
....
ActiveWorkbook.Close savechanges:=True
Application.Quit
....
Peraphs i need othe piece of code?
why Excel not is closed?
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: why Excel not is closed?
Where does this code reside? In the workbook that you're closing?
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: why Excel not is closed?
Try this instead:
ActiveWorkbook.Save
Application.Quit
ActiveWorkbook.Save
Application.Quit
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4353
- Joined: 26 Apr 2010, 17:36
Re: why Excel not is closed?
testd and it work perfect!HansV wrote:Try this instead:
ActiveWorkbook.Save
Application.Quit
Tks
-
- PlatinumLounger
- Posts: 4353
- Joined: 26 Apr 2010, 17:36
Re: why Excel not is closed?
hummmmm...HansV wrote:Try this instead:
ActiveWorkbook.Save
Application.Quit
now, if i have 2 or more session of Excel opened the code Application.Quit, close all session!!!!
But I need to close only the active sessione vwhere the code is running ...
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: why Excel not is closed?
If you want to close only the active workbook, use
ActiveWorkbook.Close SaveChanges:=True
ActiveWorkbook.Close SaveChanges:=True
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4353
- Joined: 26 Apr 2010, 17:36
Re: why Excel not is closed?
ok but the current Session of Excel remain active on screen, or not?HansV wrote:If you want to close only the active workbook, use
ActiveWorkbook.Close SaveChanges:=True
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: why Excel not is closed?
If you use Application.Quit, the active instance of Excel will close with all workbooks opened in that instance. Other instances of Excel will remain active.
If you use ActiveWorkbook.Close, only the active workbook will close, but the instance of Excel will remain active.
It's up to you to decide what you want.
If you use ActiveWorkbook.Close, only the active workbook will close, but the instance of Excel will remain active.
It's up to you to decide what you want.
Best wishes,
Hans
Hans