Forum Discussion

techgirlbb's avatar
techgirlbb
Contributor
5 years ago
Solved

How to save and close one excel file when multiple are open

Hi, Help  Java script code on how to  save and close one of the  excel file when multiple are open. My current code is working fine if only one excel is open. function Excelclose() { let ap...
  • tristaanogre's avatar
    tristaanogre
    5 years ago

    You need to set the active workbook to the one that you want to close.  Then, in your call to "Close", there is a parameter to indicate whether or not to save changes.  App.Quit is NOT how you want to go because that will Excel, not just the individual workbooks.  The only time you should call app.Quit is at the very end of your execution when you're completely done with Excel.