Running Commands When Inserting Building Blocks into Word 2007 Documents
Applies to: 2007 Microsoft Office System, Microsoft Office Word 2007
Joel Krist, Akona Systems
May 2007
Microsoft Office Word 2007 introduces building blocks to help with the process of adding frequently used content to documents. You can select building blocks from a predefined gallery of cover pages, pull quotes, headers, and footers to make documents look more professional. You can also create building blocks to simplify adding custom text, such as legal disclaimer text or other frequently used materials. The Word 2007 object model provides the Document.BuildingBlockInsert event, which is used to watch for a user inserting a new building block into a document. This how-to topic demonstrates how to use the Document.BuildingBlockInsert event to run a command in response to the insertion of a building block by a user. To demonstrate how to run a command when a building block is inserted into a document, this how-to topic walks through two key steps: adding a BuildingBlockInsert document event procedure, and adding code to the event procedure. To add a BuildingBlockInsert event procedure
Add Code to the BuildingBlockInsert Event Procedure Modify the Document_BuildingBlockInsert event procedure created earlier so that it contains code that provides the desired functionality. The following sample code displays a message box that shows the properties of the building block that was just inserted.
This article explores how to run a command in response to a user inserting a building block into a Word 2007 document using the Document.BuildingBlockInsert event. The key steps include:
|
Video Length: 00:02:34 File Size: 1.67 MB WMV |