Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.35 KB

Project.Project.Index.md

File metadata and controls

46 lines (31 loc) · 1.35 KB
title ms.service api_name ms.assetid ms.date ms.localizationpriority
Project.Index property (Project)
project-server
Project.Project.Index
1213f55b-aca0-76ee-2e8a-2442a2c576e1
06/08/2017
medium

Project.Index property (Project)

Gets the index of a Project object in the containing Projects collection. Read-only Variant.

Syntax

expression.Index

expression A variable that represents a Project object.

Example

If you put a Gantt chart in the same index of the Windows collection for every open project, you can display a Gantt chart in one project and then use the ActivateSameWindowInNextProject macro to easily switch to the Gantt charts of the other open projects.

Sub ActivateSameWindowInNextProject() 
 
 ' Check for a next project. 
 If ActiveProject.Index = Application.Projects.Count Then 
 MsgBox("No more open projects") 
 ' Check for an equivalent window in the next project. 
 ElseIf ActiveProject.Windows.ActiveWindow.Index > Projects(ActiveProject.Index + 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.Index + 1).Windows(ActiveWindow.Index).Activate 
 End If 
 
End Sub

[!includeSupport and feedback]