Code to check if workbook is the last one opened

  • Thread starter Thread starter KimberlyC
  • Start date Start date
K

KimberlyC

Hi

I need to run code from a command button that closes the Activeworkbook.
This code runs from an addin file.
I would like the code to check and see if the activeworkbook is the last
workbook open and if it is then code "a" will run and if not then code "b"
will run.

I'm not sure how to check to see if the active workbook is the last workbook
open.

Any help would be greatly appreciated.

Thanks in advance,
Kimberly
 
Kimberly,

Try

workbooks.Count

but be aware that there may be some hidden workbooks opened, such as
Personal.xls.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top