Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Excel/VB Question

Thread Tools
 
Old Apr 18, 2007 | 04:59 PM
  #1  
c3r1h5's Avatar
Thread Starter
Registered User
 
Joined: Aug 2006
Posts: 57
Likes: 0
Default Excel/VB Question

I usually never post any threads on stupid questions, but I have been searching and I can't find an answer. Off-topic almost always has an answer

I am doing an excel project and I have been looking for visual basic code. I want to be able to check how many active windows are open in excel within a macro I'm writing.

I tried: If ActiveWindow=1 Then ... but I come up with an error.

Is there any way to check how many activewindows are open in excel within a vb macro?

THANKS!
Reply
Old Apr 18, 2007 | 06:26 PM
  #2  
minboost's Avatar
Registered User
 
Joined: Apr 2001
Posts: 1,508
Likes: 0
From: Cerritos
Default

DISCLAIMER: I haven't done VBA / Office stuff since like 96 or 97.

All Windows are in a collection called Windows, whose parent is the Application.

Collections *should* have a count property, so it might be something like:

If (Application.Windows.Count() > 5) Then
...
End If

HTH.
Reply
Old Apr 18, 2007 | 06:28 PM
  #3  
Scot's Avatar
20 Year Member
 
Joined: Oct 2000
Posts: 17,288
Likes: 39
From: Nashville
Default

ibtl.
Reply
Old Apr 18, 2007 | 08:28 PM
  #4  
magician's Avatar
Registered User
 
Joined: Jul 2001
Posts: 6,592
Likes: 0
From: Yorba Linda, CA
Default

By "active windows" do you mean how many instances of Excel are open, or how many workbooks, or how many worksheets within the current workbook, or something else?
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
flitcroft
Off-topic Talk
9
Mar 30, 2005 08:56 AM
redleader
Off-topic Talk
5
Sep 13, 2004 05:25 PM
ICrazyChrisI
Off-topic Talk
2
Jun 23, 2003 10:48 AM




All times are GMT -8. The time now is 07:34 PM.