Table of contents
TOC
Recolher sumário
Expandir sumário

Propriedade Resource.Initials (projeto)Resource.Initials Property (Project)

office 365 dev account|Última Atualização: 22/03/2018
|
2 Colaboradores

Obtém ou define as iniciais de um recurso. Cadeia de caracteresde leitura/gravação.Gets or sets the initials of a resource. Read/write String.

SintaxeSyntax

expressão. Iniciaisexpression. Initials

expressão Uma variável que representa um objeto Resource .expression A variable that represents a Resource object.

ExemploExample

O exemplo a seguir define as iniciais de cada recurso do projeto ativo conforme os espaços no nome do recurso. Por exemplo, um recurso chamado "Pistola" recebe as iniciais "GG".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
© 2018 Microsoft