Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-11-2014, 10:12 AM
gmaxey gmaxey is offline VBA using Building Blocks to build document Windows 7 32bit VBA using Building Blocks to build document Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,600
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Maybe something like:

Code:
Dim objTemplate As Template
Dim objBB As BuildingBlock
Dim arrBBNames() As String
Dim lngIndex As Long
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate
Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustom1) _
.Categories("General").BuildingBlocks("PHN Box")
' Insert the building block into the document replacing any selected text.
objBB.Insert ActiveDocument.Bookmarks("PHNBox").Range
arrBBNames = Split("Internal AHS,Disclaimer,Blank Line,etc.", ",")
For lngIndex = 0 To UBound(arrBBNames)
  Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustom1) _
              .Categories("General").BuildingBlocks(arrBBNames(lngIndex))
  objBB.Insert Selection.Range
Next lngIndex
But why don't you just create a template with all of this content and start your documents based on the template?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing Building Blocks dricciuti Word 0 11-03-2013 03:40 PM
Building blocks show correctly in dropdown, but wrong building block populates in doc wordgirl123 Word 0 10-03-2013 08:30 AM
Building Blocks Organizer Neece Office 0 08-06-2011 05:14 AM
VBA using Building Blocks to build document Building Blocks - WHY??? namedujour Word 5 05-03-2011 01:37 PM
Building blocks in 2007 derohanes Office 6 03-05-2011 01:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:11 PM.


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