共用方式為


Resource.Initials 屬性 (Project)

會取得或設定資源的簡稱。 可讀寫的 String

語法

expressionInitials

表達 代表 Resource 物件的變數。

範例

下面範例根據資源名稱內的空格,設定使用中專案內每一資源的簡稱。 例如,一個命名為 "Glue Gun" 的資源簡稱為 "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

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應