Pesach's post allowed me to get this working for a Word 2007 template - this
macro starts the user out with a blank word 2007 .doc that has a macrobutton
named "Add a new Definable Feature". In an Autotext entry named
DefinableFeature, I have a simple word table stored (2 columns, 4 rows.)
The desired action now works for Word 2007...each time the user presses the
macrobutton, a new copy of the table is inserted, which allows the user to
build a cumulative series of tables.
But Pesach's caution that the syntax has to be changed depending on the
version of Word, is an unexpected problem. I need to be able to distribute
this as a template to all users....whether they have Word 2003 or Word
2007...and be sure it will work for everyone. What's the best way to do
that, if you are not sure who has what version of Word?
Sub DefinableFeature()
Options.ButtonFieldClicks = 1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.TypeBackspace
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"MACROBUTTON DefinableFeature Feature", PreserveFormatting:=False
Selection.TypeParagraph
Selection.TypeParagraph
Templates(1).BuildingBlockEntries("DefinableFeature").Insert Where:= _
Selection.Range, RichText:=True
Selection.Font.Reset
Selection.Font.Color = wdColorWhite
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub