Workbooks Index (Excel 97)

  • Thread starter Thread starter David Copp
  • Start date Start date
D

David Copp

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
(e-mail address removed)
 
Hi Dave:

Apparently workbooks do not expose the Index property.

Regards,

Vasant.
 
? 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.
 
Back
Top