Share via


Resource.Initials property (Project)

Ruft das Kürzel einer Ressource ab, oder legt es fest. String-Wert mit Lese-/Schreibzugriff.

Syntax

Ausdruck. Initials

Ausdruck Eine Variable, die ein Resource-Objekt darstellt.

Beispiel

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

Support und Feedback

Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.