I'm at my wits end, I hope someone can help. I an trying to figure out how to
insert a specfic quick part I have created at a bookmark in my word 2007
document through VBA. I need code that will allow me to loop the entry
several times as needed, one time I will need to insert the quick part 3
times and one time 5 times. Now the quick part are saved in the document
template not the "normal.doc" tempate.
Take a look at the Working with Building Blocks item in the Word Developer
Reference that you can access through the Help facility in the Visual Basic
Editor.
It contains the following on inserting a Building Block Entry:
Inserting a Building Block into a Document
After you have access to a building block, use the Insert method of the
BuildingBlock object to insert it into a document. The following example
expands the previous code sample by adding a line for inserting the building
into the active document at the Insertion Point (or for replacing the
selected text, if text is selected).
Note
When you insert a building block by using the Ribbon, Word automatically
determines certain things about the building block, such as where to insert
it; however, when you insert a buildng block through the object model, none
of this built-in intelligence automatically happens. For example, when you
insert a header building block by using the Ribbon, Word automatically
determines to replace the existing header. When inserting the same header
building block by using the object model, you need to explicitly specify
where to place the building block text.
Sub InsertExistingBuildingBlock()
Dim objTemplate As Template
Dim objBB As BuildingBlock
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate
' Access the building block through the type and category
Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustomHeaders) _
.Categories("Book Titles").BuildingBlocks("Title")
' Insert the building block into the document replacing any selected
text.
objBB.Insert Selection.Range
End Sub

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> I'm at my wits end, I hope someone can help. I an trying to figure out how
> to
[quoted text clipped - 3 lines]
> times and one time 5 times. Now the quick part are saved in the document
> template not the "normal.doc" tempate.