ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbooks Index (Excel 97) (https://www.excelbanter.com/excel-programming/276962-workbooks-index-excel-97-a.html)

David Copp

Workbooks Index (Excel 97)
 
Greetings,

Would like to be able to use "Index" for workbook collection but does not
appear to be able to do so.

'i.e. index works fine for sheet collections as in following
MsgBox ActiveWorkbook.ActiveSheet.Index

'but fails at workbook level.
MsgBox ActiveWorkbook.Index

Any help would be appreciated.

Thanks,

Dave




Vasant Nanavati[_2_]

Workbooks Index (Excel 97)
 
Hi Dave:

Apparently workbooks do not expose the Index property.

Regards,

Vasant.

"David Copp" wrote in message
. ca...
Greetings,

Would like to be able to use "Index" for workbook collection but does not
appear to be able to do so.

'i.e. index works fine for sheet collections as in following
MsgBox ActiveWorkbook.ActiveSheet.Index

'but fails at workbook level.
MsgBox ActiveWorkbook.Index

Any help would be appreciated.

Thanks,

Dave






Tom Ogilvy

Workbooks Index (Excel 97)
 
? thisworkbook.Windows(1).Index
2

or
ActiveWorkbook.windows(1).Index

Ran this
Sub CheckIndex()
For Each wkbk In Workbooks
Idex = wkbk.Windows(1).Index
i = 0
For Each wkbk1 In Workbooks
i = i + 1
If wkbk1.Name = wkbk.Name Then
idex1 = i
Exit For
End If
Next

Debug.Print Idex, idex1, _
Workbooks(Idex).Name, Workbooks(idex1).Name
Next

End Sub

and it clearly showed me there is no correlation between the Index of the
workbook collection and the index of the Windows collection, but you may be
able to meet your need by using the windows collection.

? activewindow.Index, activewindow.Parent.Name
1 check_proc.xls

Of course the activewindow is always going to be index 1. The parent of a
window is a workbook object.

--
Regards,
Tom Ogilvy



David Copp wrote in message
. ca...
Greetings,

Would like to be able to use "Index" for workbook collection but does not
appear to be able to do so.

'i.e. index works fine for sheet collections as in following
MsgBox ActiveWorkbook.ActiveSheet.Index

'but fails at workbook level.
MsgBox ActiveWorkbook.Index

Any help would be appreciated.

Thanks,

Dave







All times are GMT +1. The time now is 01:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com