Application Quit closing down all instances of Excel

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
I've been fighting with application.quit for a while now because it wouldn't close excel. I had this in the open even and first check to see if the user had read write privileges to a folder they will need for everything to work. I got that squared away by putting and Exit Sub after the Application.quit (if they fail the test to see if they have access).

Now I'm seeing the Application.Quit is closing ALL instances of Excel. So if the user is working on something, and opens one of my templates and doesn't have access... It will close down my Excel and then close the other one they had open without asking to save.

Is this normal or can I do something to just close down my instance of Excel?

Mark
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,737
Office Version
  1. 2016
Platform
  1. Windows
How about closing the workbook only and not the whole application

Code:
ThisWorkbook.Close False
 

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,096
Office Version
  1. 2016
Platform
  1. Windows
How about closing the workbook only and not the whole application

Code:
ThisWorkbook.Close False

Why do we use the false instead of true?

I have stambled at this for long. Have read some articles but don't seem to get the clear picture yet.

And what's the benefit of the close over the quit?
Regards
 

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
Jaafar, I think that is what I'll need to settle with. Not idea, but better than shutting down any workbooks they may have open and not saved... I don't want to take anyone's work and throw it under the bus.

Kelly, closing leaves the Excel application open, without a workbook open, basically a grey screen where the user needs to take the extra step to close Excel. That's why I would prefer to quit Excel. In my file they bring up will not be saved anyway, its just a documentation template that sends their input out to a text file. In this case the text files goes to a secure folder. If they don't have access to the secure folder, no since filling out the template. I'm trying to reduce frustration, but if quitting Excel causes frustration by closing down their work, better to do what Jaafar says, just close the workbook.

Thanks for the Input Jaafar!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
76,251
Office Version
  1. 365
Platform
  1. Windows
Is your code opening the file in a new instance of Xl? If what is that code?
 

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
Fluff, I hadn't thought of that... Code isn't opening the XL file. They are opening up from SharePoint, however the same thing happens when opened from the desktop. The just double click on the file and it's open. When there is no other XL file open, there is only one instance of Excel... When there is another file open first, there are two instances of XL. Is there a way to force a completely separate instance of XL when opening a file, that won't cause the other instances of XL to close when Application.Quit is used?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
76,251
Office Version
  1. 365
Platform
  1. Windows
I've never used sharepoint, so know nothing about it, but if I open multiple files from my hard drive I only get 1 instance of Xl running (albeit in multiple windows).
 

Forum statistics

Threads
1,171,864
Messages
5,877,961
Members
433,304
Latest member
niresh28

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top