Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Code to check if workbook is the last one opened

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code to check if workbook is the last one opened

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)

"KimberlyC" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check a sheet each time file opened? Don Excel Discussion (Misc queries) 1 February 24th 09 06:27 PM
Formating Cells used code when worksheet opened Don Excel Worksheet Functions 2 December 12th 06 06:29 AM
How do I check opened wokbooks? TY Excel Programming 3 January 23rd 04 02:37 PM
Is it possible to require that a KEY NUMBER be imputed in a workbook 1 before workbook 2 can be opened? Marcello do Guzman Excel Programming 0 October 15th 03 06:29 PM
Code to tell if workbook is opened in browser BrianB Excel Programming 5 August 19th 03 02:47 PM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"