Plus, you can use building blocks with content controls to give you even greater control over which building blocks users can insert into their documents. You can also watch for when users insert new building blocks into a document by using the BuildingBlockInsert event. You can create new building blocks, delete building blocks, and manage building blocks programmatically. However, building block are also programmable. The incredible flexibility that building blocks provide help you to create custom solutions without writing code. For example, you can have a building block named "Title" that has a type of wdTypeBibliography and a category of "Book Titles" and another building block named "Title" that has a type of wdTypeBibliography and a category of "Movie Titles" and then you can have yet another building block named "Title" that has a type of wdTypeCustomHeaders and a category of "Book Titles" and so on. Types and categories are explained later in this topic.īecause you can organize building blocks into types and categories, building blocks can be incredibly flexible. A category can be any string that you define. However, you are not limited to just the categories that are included in these templates. By default, the templates that are included with Word have building block categories like "General" and "Built-In". These types help you to define and organize your building blocks and, although you cannot create additional building block types, you can create an unlimited number of categories for each type.Ĭategories are composed of an unlimited number of strings that you can define to organize your custom building blocks. There are 35 different WdBuildingBlockTypes constants. Although there are a limited number of these constants, that number is not small. Building block types are composed of a limited number of WdBuildingBlockTypes constants. NameĪ collection of building block entries in a template that are of the same type and category.Ī collection of all the building blocks in a template.Ī collection of building block categories.īuilding blocks are organized by type and category. The new objects and collections are listed in the following table. These enable you to create an organizational structure that works for your specific needs and to modify the structure for a specific solution. The building blocks object model includes three new objects and four new collections. When used together with content controls, building blocks can enable you to develop powerful solutions quickly and easily. A custom building block helps users insert rich content anywhere in a document by using a formatted drop-down list. However, with building blocks, you can organize entries in a way that enables you to determine how a user uses them. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.Introduced in Word 2007, building blocks are similar to autotext entries in previous versions. ' text remains Word removes the items in the list. ' a drop-down it is a text content control. ' After running the above code, the content control is no longer ' Notice that the content control is a drop-down list. ' Switch to view the new content control in the active document. ObjCC.SetPlaceholderText Text:="My Favorite Animal" Set objCC = (Type:=wdContentControlDropdownList) The following example inserts a drop-down list content control and then changes it to be a rich-text content control. The following example inserts a new date content control that contains the current date and then changes it to be a text content control. In this case, Word raises a run-time error. For example, if you have a rich-text content control that contains formatted text, you may not be able to change the control to be a plain-text content control. Depending on the contents of a content control, you may not be able to change the content control type.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |