Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Number of workbooks is....
Workbooks.Count Display each name in MsgBox..... Dim wB As Workbook For Each wB In Workbooks MsgBox wB.Name Next -- Regards, Nigel "DKS" wrote in message ... Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi DKS
You can count the workbooks in the loop Dim wb As Workbook For Each wb In Application.Workbooks MsgBox wb.Name Next wb -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "DKS" wrote in message ... Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Forgot to add this
Test if the workbooks are visible in the loop if that is important. For example if you want to be sure that there is a visible workbook open Personal.xls will count as 1 for example -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi DKS You can count the workbooks in the loop Dim wb As Workbook For Each wb In Application.Workbooks MsgBox wb.Name Next wb -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "DKS" wrote in message ... Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is some code to try...
Sub test() Dim wbk As Workbook MsgBox Workbooks.Count For Each wbk In Workbooks MsgBox wbk.Name Next wbk End Sub Note that this code will be correct if there is only one open instance of XL. If you have multiple open instances then it only works on the instance that it is in. That should not be a problem but it is something to be aware of... -- HTH... Jim Thomlinson "DKS" wrote: Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If we open several excel files, would it not be in the same instance of Excel
by default? "Jim Thomlinson" wrote: Here is some code to try... Sub test() Dim wbk As Workbook MsgBox Workbooks.Count For Each wbk In Workbooks MsgBox wbk.Name Next wbk End Sub Note that this code will be correct if there is only one open instance of XL. If you have multiple open instances then it only works on the instance that it is in. That should not be a problem but it is something to be aware of... -- HTH... Jim Thomlinson "DKS" wrote: Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you double click on an XL file then it opens in one instance of XL. If you
then choose file | Open or if you double click on another XL file it will be opened in the same original instance. If you now click on Start | Programs .... Excel then you get another instance of XL. Files opened in this instance know nothing of the other instance and Vice Versa. If you look in Task manager you will see 2 seperate XL processes running... -- HTH... Jim Thomlinson "DKS" wrote: If we open several excel files, would it not be in the same instance of Excel by default? "Jim Thomlinson" wrote: Here is some code to try... Sub test() Dim wbk As Workbook MsgBox Workbooks.Count For Each wbk In Workbooks MsgBox wbk.Name Next wbk End Sub Note that this code will be correct if there is only one open instance of XL. If you have multiple open instances then it only works on the instance that it is in. That should not be a problem but it is something to be aware of... -- HTH... Jim Thomlinson "DKS" wrote: Hi, How can I programatically (via module) determine the number of open workbooks? Ideally I would love to also determine the names (titles) of each open workbook, but if that is too much then I can at least live with the retrieval of info on the number of open workbooks. Many thanks in anticipation. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to tell the number of current open workbooks... | Excel Worksheet Functions | |||
Determining repeated cells between two workbooks | Excel Programming | |||
Determining if Other Workbooks Are Open | Excel Programming | |||
count number of workbooks open | Excel Programming | |||
Number of workbooks open | Excel Programming |