View Single Post
  #17   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 264
Default Newbie macro help please

On Feb 19, 5:26*pm, "John... Visio MVP"
wrote:
"Barnet" wrote in message

news
Are they people I can get in touch within some way? Or might they read
this
here in the forum? Or can you ask them about this?


Barnet


"John... Visio MVP" wrote:


It is possible, but I think someone like Graham Mayor or Greg Maxek know
the
workaround.


John..


They usually read the newsgroup, so I was hoping one of them *(or any of the
other experts here) would see the bat signal and reply.
It seems Doug has risen to the challenge with an answer.

And before I get in trouble, it is Greg Maxey not Greg Maxek. Sorry about
that Greg.

John.. Visio MVP


John,

If I was upset my spelling errors then I would always be upset with
myself. No problem.

I haven't followed all of this thread, so what I am posting may have
already been addressed of of no value.

While it can often be a good place to start, the recorder can also
make a dog's breakfast out of any attempt to create macro. This is a
case in point. The problem is that the builidngblocks in question are
not part of the attached template but a one of the predefined building
blocks that ships with Word and stored in the Bluilding Blocks.dotx
file. Worse yet, this collection isn't available if Building
Blocks.dotx isn't loaded.

Writing from scratch you could use the following, but I believe that
Doug's suggestion is better.

Sub ScratchMacro()
Dim oTmp As Template
Templates.LoadBuildingBlocks
For Each oTmp In Templates
If oTmp.Name = "Building Blocks.dotx" Then Exit For
Next oTmp
oTmp.BuildingBlockEntries(" Blank").Insert Selection.Range
'Or
'oTmp.BuildingBlockTypes(wdTypeFooters).Categories ("Built-
In").BuildingBlocks(" Blank").Insert Selection.Range
oTmp.BuildingBlockEntries("Plain Number 2").Insert Selection.Range
End Sub