Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2013, 12:55 PM
jasserin jasserin is offline INSERT building blocks from Quickpart in word Windows XP INSERT building blocks from Quickpart in word Office 2007
Novice
INSERT building blocks from Quickpart in word
 
Join Date: Jun 2013
Posts: 1
jasserin is on a distinguished road
Angry INSERT building blocks from Quickpart in word


Hello,

New in vba. I search to insert very simply a building block from quickpart inside my word document but I can't. I have find the classical VBA code :

Code:
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
But it is not working.

Another link advices to load preliminary the templates with :

Templates.LoadBuildingBlocks

I do it and I have try this following code :

Code:
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(Bibliographies) _
.Categories("Prédifini").BuildingBlocks("Travaux cités")
 
' Insert the building block into the document replacing any selected 
text.
objBB.Insert Selection.Range
 
End Sub
But it is not working

I have try this folowing code to indicate the way of the file building blocks.dotx

Code:
Sub TestBuildingBlocks()
 
Templates.LoadBuildingBlocks ' chargement du template building blocks
 
Templates("C:\Utilisateur\ utilisateur\AppData\Roaming\Microsoft\Document Building Blocks\1036\Building Blocks.dotx"). _
BuildingBlockTypes("bibliography").Categories("Prédéfini").BuildingBlocks("Travaux cités").Insert Where:=Selection.Range
 
End Sub
It doesn't work !

Could you please help me to insert a building block from quickparts. I enclosed 2 images from the templates and the quickparts content.

I need your help,

Thank you very much,

sincerely

jasserin
Attached Images
File Type: jpg quickpart.jpg (82.5 KB, 17 views)
File Type: jpg vba building blocks.jpg (64.6 KB, 16 views)

Last edited by macropod; 09-29-2013 at 08:49 PM. Reason: Added code tags
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
INSERT building blocks from Quickpart in word Building Blocks - WHY??? namedujour Word 5 05-03-2011 01:37 PM
Building Blocks in Outlook namedujour Outlook 2 04-06-2011 06:29 AM
Word - Attach Building Blocks namedujour Word 0 04-04-2011 09:59 AM
Building blocks in 2007 derohanes Office 6 03-05-2011 01:31 PM
Word 2007 Building Blocks - difficult to update... Ian Hunneybell Word 0 10-19-2009 06:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft