Have code that closes all but active workbook (see below), but also closes the hidden personal.xlsb file. Hoping there's a simple addition to not close the personal file?
Many thanks!![]()
Please Login or Register to view this content.
Have code that closes all but active workbook (see below), but also closes the hidden personal.xlsb file. Hoping there's a simple addition to not close the personal file?
Many thanks!![]()
Please Login or Register to view this content.
Modify the logic to check if the workbook name through iteration is not your personal.xlsb workbook as well.
![]()
Please Login or Register to view this content.
A thing of beauty... many thanks!!
well.... i'm sorry... spoke too soon... it's still closing the personal.xlsb file... I tried changing AND to OR and same result... also confirmed file name... thoughts?
How about
![]()
Please Login or Register to view this content.
hmmm... no dice... I'll keep searching as well... thanks for trying!
Humor mewhat happens if you run this.
![]()
Please Login or Register to view this content.
The first and only message box: "Closing PERSONAL.XLSB"
:|
What are you actually trying to do?
Why do you want to close all workbooks bar the active and personal ones?
By the way, which workbook is the code in?
If posting code please use code tags, see here.
Norie, I have code that opens several variably-named workbooks, and would like to close them all except my main workbook at the end of the code. But I want to leave the personal file open because that's where the module and macros are.
Poizhan, it worked! Didn't know VBA was case-sensitive... I went back to your second option above and finished with this:
Again, and this time for real, it works! Thanks!!![]()
Please Login or Register to view this content.
Perhaps
![]()
Please Login or Register to view this content.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Why not close the workbook(s) you are opening once you've 'finished' with them?
Wouldn't that be a better idea?
well.... yes it would... come to think of it...
but this was more fun, and I learned some new tricks, so that's a plus!
![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks