Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Clarification on "Application.Worbooks.Count" proceedure

Hi all, i use the code below to count the workbooks open.
My problem, i have my workbook "Recon_Tools.xls" open and Book1, Book2 &
book3 but it shows me a count of "2" ?? I believe it should show me a
count of "4" ?? Any help would be appreciated.

Sub testing1()
'
Dim wkb As Integer
wkb = Application.Workbooks.Count
If wkb = 2 Then
Application.Quit
Else
Unload SelectionForm
ActiveWorkbook.Close
Workbooks("Recon_Tool.xls").Close
End If
End Sub


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Clarification on "Application.Worbooks.Count" proceedure

Hi
Works ok for me and gives a count of 4. Do you have more than one
instance of Excel open?

regards
Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Clarification on "Application.Worbooks.Count" proceedure

Hi Paul, i have my workbook with script open and then i open excel again
giving me "Microsft Excel - Book1" and "Microsft Excel - Book2"2 as
well.
But i still only get a figure of 2 ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clarification on "Application.Worbooks.Count" proceedure

The two separate instances of excel are just that - separate programs and
have no relationship to each other. Each is a separate application with its
own workbooks.count.

--
Regards,
Tom Ogilvy


"Les Stout" wrote in message
...
Hi Paul, i have my workbook with script open and then i open excel again
giving me "Microsft Excel - Book1" and "Microsft Excel - Book2"2 as
well.
But i still only get a figure of 2 ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Clarification on "Application.Worbooks.Count" proceedure

Thanks Tom, but what is confusing me is that with just my workbook open
i still get a a count of two ?


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Clarification on "Application.Worbooks.Count" proceedure

Hi
Does your excel open with a blank workbook by default? You might not
spot it is open with the "helpful" Window intelli-menu

Paul

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Clarification on "Application.Worbooks.Count" proceedure

Hi Paul, i cannot see another workbook or does it see the personal as a
workbook as well ? Sorry bit of a newbie at this game and not sure what
the "helpful" window intelli-menu is ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clarification on "Application.Worbooks.Count" proceedure

Do you have a personal macro workbook that is hidden?

Just write a macro an clear up the mystery

sub showbooks()
for each bk in Workbooks
msgbox bk.name
Next
end sub

--
Regards,
Tom Ogilvy


"Les Stout" wrote in message
...
Hi Paul, i cannot see another workbook or does it see the personal as a
workbook as well ? Sorry bit of a newbie at this game and not sure what
the "helpful" window intelli-menu is ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Clarification on "Application.Worbooks.Count" proceedure

At last.... Thanks Tom you are my lifesaver !!

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
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
Create Pivot Table Data with Column "Sum" rather than "count" defa Johnny_99[_2_] Excel Discussion (Misc queries) 2 January 2nd 10 03:25 PM
Pivot tables - how do I change default from "count of" to "sum of" Cathy H Excel Worksheet Functions 2 November 19th 08 01:31 AM
EXCEL allow 2 options on status bar e.g. show "Count" + "Sum" LEJM Excel Discussion (Misc queries) 2 November 15th 07 07:49 PM
Count(if(A3:A200)="100000" if (B3:B200="Y") and (C3:C200=Z))) Prasad Excel Discussion (Misc queries) 2 June 27th 06 06:39 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:33 PM.

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

About Us

"It's about Microsoft Excel"