Categories オブジェクト (Word)
文書パーツのカテゴリのコレクションを表します。
注釈
Item メソッドを使用して、既存のカテゴリにアクセスします。 その後、 BuildingBlocks プロパティを使用して、カテゴリの BuildingBlock オブジェクトのコレクションにアクセスできます。 The following example prints the type and category names of all the building blocks in the first template to the Immediate Window. (This example assumes that the Immediate Window is visible.)
Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer
Set objTemplate = Templates(1)
For intCount = 1 To objTemplate.BuildingBlockTypes.Count
Set objBBT = objTemplate.BuildingBlockTypes(intCount)
If objBBT.Categories.Count > 0 Then
Debug.Print objBBT.Name
For intCountCat = 1 To objBBT.Categories.Count
Set objCat = objBBT.Categories(intCountCat)
Debug.Print vbTab & objCat.Name
Next
End If
Next
Item メソッドを使用して既存のカテゴリにアクセスします。新しいカテゴリを作成するには、BuildingBlockEntries コレクションの Add メソッドを使用します。 カテゴリ パラメーターの値を設定します。
文書パーツの詳細については、「文書パーツを操作する」を参照してください。
関連項目
サポートとフィードバック
Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。