Searching Building Blocks

I

Istari

we have created an large amount of building blocks and I would like mto know
whether there's any way to allow users to search for any given building block.


Also, is there a way to restrict users from making changes to building
blocks, and maybe export the entire contents of the buildingblocks.dotx (with
the buildintg block names) to excel, for example.


Any help is appreciated.
 
C

Cindy M.

Hi =?Utf-8?B?SXN0YXJp?=,
we have created an large amount of building blocks and I would like mto know
whether there's any way to allow users to search for any given building block.
The Building Block Organizer tool (Insert Tab, Text group, Quick parts menu)
should be able to do this, to a certain extent. If you assign your Building
Blocks to Galleries and Categories, the user can sort by these and find what is
required relatively quickly.

If that's not good enough, then you'll have to roll your own.
Also, is there a way to restrict users from making changes to building
blocks, and maybe export the entire contents of the buildingblocks.dotx (with
the buildintg block names) to excel, for example.
I recommend you place the building blocks in a different template than Building
Blocks.dotx as Word could recreate that from the installation default if
something "unexpected" happens. Just put your Building Blocks template in the
same folder, or the Startup folder and they should load.

You can try saving the template as "Read-only" (it's not something I've ever
tested with Building Blocks) to protect the entries from the user changing them.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
N

Neil Cumfer

I doubt that Microsoft provided a way to search for a building block,
other than alphabetizing the list in the Building Blocks Organizer

It might be helpful for searching to put them in an Excel database

The Word 2007 macro below will create a searchable Word document ... you
can
customize it to suit

I doubt if you could prevent users from making changes to
building blocks but you might be able to prevent them from replacing
existing building blocks with their changes (perhaps by making the
template or it's folder read-only)

The macro creates a Word document. Each building block in the
template is inserted on a new page and labeled.

Sub SearchableBuildingBlocksMacro()

Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer

Dim objBB As BuildingBlock
Dim objBBC As BuildingBlocks

Documents.Add

'next line saves in the current default folder on the current drive
ActiveDocument.SaveAs FileName:="SearchableBuildingBlocks.docx"

'change next line to match location on your hard drive
ActiveDocument.AttachedTemplate = "c:\Documents and
Settings\XXXXX\Application Data\Microsoft\Document Building
Blocks\####\Building Blocks.dotx"
'repeat macro when done, substituting other building block templates
including the Normal template

Set objTemplate = ActiveDocument.AttachedTemplate

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
Set objBBT = objTemplate.BuildingBlockTypes(intCount)
If objBBT.Categories.Count > 0 Then
For intCountCat = 1 To objBBT.Categories.Count
Set objCat = objBBT.Categories(intCountCat)

Set objBBC = objCat.BuildingBlocks
For i = 1 To objBBC.Count
Set objBB = objBBC(i)

Selection.TypeText Text:="Building Block Name:" & vbTab &
objBB.name
Selection.TypeParagraph

Selection.TypeText Text:="Gallery:" & vbTab & objBBT.name
Selection.TypeParagraph

Selection.TypeText Text:="Category:" & vbTab & objCat.name
Selection.TypeParagraph

Selection.TypeText Text:="Description (in any):" & vbTab &
objBB.Description
Selection.TypeParagraph

objBB.Insert Selection.Range
Selection.InsertBreak Type:=wdSectionBreakNextPage
ActiveDocument.Save
Next i

Next intCountCat
End If
Next intCount

ActiveDocument.AttachedTemplate = ""
ActiveDocument.Save

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top