+ Reply to Thread
Results 1 to 12 of 12

Use Application.quit after close

  1. #1
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Use Application.quit after close

    Is there a way to use application quit for just "thisworkbook"

    I mean:

    I have several workbook's open, although if i close 1 and use application.quit (i need to use this code btw), it quits all workbooks.

    Is there a way to close the application but just for this workbook? so i can keep the other workbook's safe?

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Use Application.quit after close

    No Application.Quit closes Excel. You would need to use Workbook("Name").Close or Activeworkbook.close or Thisworkbook.close.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,445

    Re: Use Application.quit after close

    Hi brainzlp,

    I think you need to only close a single workbook instead of trying to close Excel.

    Perhaps something like:

    Application.ActiveWorkbook.Close

    will do what you want.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Use Application.quit after close

    i already tested that solution, doesn't work cuz the application stills open

  5. #5
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Use Application.quit after close

    Quote Originally Posted by JOHN H. DAVIS View Post
    No Application.Quit closes Excel. You would need to use Workbook("Name").Close or Activeworkbook.close or Thisworkbook.close.
    Please Login or Register  to view this content.
    tHIS IS what i have at moment, although have 1 problem:
    Where line is bold, the file reopens after i close it, it saves perfectly, although it reopens if i have another file open

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,445

    Re: Use Application.quit after close

    So, you want some of the workbooks to stay open in Excel after you close Excel. I think this is impossible as closing Excel will also close all the workbooks too.

    That is why I suggested only closing the specific workbook and leaving Excel open so the others were still in computer memory and working.

    The bottom line is: If you close the application, all programs/files that are using that application will also close.

  7. #7
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516
    Quote Originally Posted by MarvinP View Post
    So, you want some of the workbooks to stay open in Excel after you close Excel. I think this is impossible as closing Excel will also close all the workbooks too.

    That is why I suggested only closing the specific workbook and leaving Excel open so the others were still in computer memory and working.

    The bottom line is: If you close the application, all programs/files that are using that application will also close.
    I know that, thats why the line is commented out. My problem is that in that line the excel reopens after i closed it. (ontime is turned off by macro 'resetandstopclock)

    Please let me know what can i do

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,445

    Re: Use Application.quit after close

    So you are saying the application didn't really close???

    Try this trick.

    Application.Quit
    DoEvents

    Put DoEvents after the quit and see if that helps.

  9. #9
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Use Application.quit after close

    I am not making myself clear. The problem is that the file closes although it REOPENS after.. I cant use application quit although it closes all workbooks (i have more than 1open as you can see in the code)
    Last edited by brainzlp; 02-17-2016 at 06:51 PM.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Use Application.quit after close

    Any Application.OnTime or buttons/shapes code that is linked to the workbook being closed?
    If posting code please use code tags, see here.

  11. #11
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Use Application.quit after close

    Yes as told before, i have ontime event although i stop it on before close event with macro "resetandstopclock" it works perfectly if thisworkbook is the only one open. If there is another excel ope, thisworkbook reopens after close

  12. #12
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Covilhã
    MS-Off Ver
    2010
    Posts
    516

    Re: Use Application.quit after close

    About buttons and shapes there are no links between workbooks, each one has its own

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Truly quit Excel using Application.Quit doesn't work
    By bta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2012, 04:44 AM
  2. Event difference Close / Quit
    By ripuz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-13-2012, 02:22 PM
  3. Access.Application.Quit - opens Access again then won't close - He
    By Hluhluwe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2006, 07:20 AM
  4. Application.Quit
    By Henry Hayden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2005, 12:00 PM
  5. [SOLVED] difference application.quit & application.close
    By Pierre via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2005, 04:00 PM
  6. [SOLVED] application.quit
    By Murat Demir HEKIMOGLU in forum Excel General
    Replies: 3
    Last Post: 08-24-2005, 03:05 AM
  7. Application.Quit
    By Murat Demir HEKIMOGLU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2005, 08:05 AM
  8. application.quit
    By Murat Demir HEKIMOGLU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 05:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1