Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-29-2023, 03:21 AM
MartinGM MartinGM is offline Close file or quit application ? Windows 11 Close file or quit application ? Office 2021
Advanced Beginner
Close file or quit application ?
 
Join Date: May 2023
Location: England
Posts: 66
MartinGM is on a distinguished road
Default Close file or quit application ?

I would like to create a macro which works as below but I can't quite see how to do it . . .
  • If another Excel workbook is not open, save the active workbook, close it and quit Excel
  • If another Excel workbook is open, save the active workbook and close it - leaving the other workbook(s) open.
I know how to do all of this, except how to detect if another Excel workbook is open.


Thanks for any help
Reply With Quote
  #2  
Old 09-29-2023, 03:25 AM
MartinGM MartinGM is offline Close file or quit application ? Windows 11 Close file or quit application ? Office 2021
Advanced Beginner
Close file or quit application ?
 
Join Date: May 2023
Location: England
Posts: 66
MartinGM is on a distinguished road
Default

OK, I solved this myself using Application.WORKBOOKS.Count
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
The Word userform checkbox (checked/unchecked) is not saved on the Application Quit matapagi2019 Word VBA 3 03-31-2019 02:29 AM
Close file or quit application ? After a specific file is closed, Excel asks again if I want to close the same file -- and ruins it HGilbert Excel 1 01-24-2017 08:37 AM
Opening a MS .dot file through ASP.Net application eljapo4 Word 0 09-14-2012 01:11 AM
EXCEL tries to close a file userman Excel 2 05-31-2012 03:15 AM
Excel 2003 will not terminate with application.quit Peter Schellenbach Excel 12 03-14-2006 05:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft