Returns the index of an object in its containing collection. Read-only Long.
Syntax
expression.Index
expression A variable that represents a TimeScaleValue object.
Return Value
Long
Example
If you always put a Gantt chart in the same index of a project's Windows collection, you can display a Gantt chart in one project and then use this macro to easily switch to the Gantt charts of your other projects.
Visual Basic for Applications
Sub ActivateSameWindowInNextProject()
' Check for a next project.
If ActiveProject.<strong class="bterm">Index</strong> = Application.Projects.Count Then
MsgBox("No more open projects")
' Check for an equivalent window in the next project.
ElseIf ActiveProject.Windows.ActiveWindow.<strong class="bterm">Index</strong> > Projects(ActiveProject.<strong class="bterm">Index</strong> + 1).Windows.Count Then
MsgBox("No equivalent window in the next project")
' If everything's okay, switch to the window in the next project.
Else
Projects(ActiveProject.<strong class="bterm">Index</strong> + 1).Windows(ActiveWindow.<strong class="bterm">Index</strong>).Activate
End If