Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.44 KB

Project.Resource.Initials.md

File metadata and controls

59 lines (40 loc) · 1.44 KB
title ms.service api_name ms.assetid ms.date ms.localizationpriority
Resource.Initials property (Project)
project-server
Project.Resource.Initials
b74494c1-955d-2984-9c3c-4271d382deb1
06/08/2017
medium

Resource.Initials property (Project)

Gets or sets the initials of a resource. Read/write String.

Syntax

expression. Initials

expression A variable that represents a Resource object.

Example

The following example sets the initials of each resource in the active project according to the spaces in the resource's name. For example, a resource called "Glue Gun" receives the initials "GG."

Sub SetInitialsBasedOnName() 
 
 Dim I As Integer ' Index used in For loop 
 Dim R As Resource ' Resource used in For Each loop 
 Dim NewInits As String ' The new initials of the resource 
 
 ' Cycle through the resources of the active project. 
 For Each R In ActiveProject.Resources 
 ' Initialize with first character of name. 
 NewInits = Mid(R.Name, 1, 1) 
 
 ' Look for spaces in the resource's name. 
 For I = 1 To Len(R.Name) 
 ' If not first character, and space is found, then add initial. 
 If I > 1 And Mid(R.Name, I, 1) = Chr(32) Then 
 If I + 1 <= Len(R.Name) Then 
 NewInits = NewInits & Mid(R.Name, I + 1, 1) 
 End If 
 End If 
 Next I 
 
 ' Give the resource its new initials. 
 R.Initials = NewInits 
 
 Next R 
 
End Sub

[!includeSupport and feedback]