View Single Post
 
Old 09-22-2017, 07:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There are many things macro won't record, including most Ribbon actions. In any event, when creating code, the macro recorder is about as smart as a box of rocks.

The code you've posted as Macro3 is missing some required BuildingBlockEntries.Add parameters. The required parameters are:
• Name
• Type
• Category
• Range
The macro recorder should have recorded all of the required parameters, but evidently it doesn't.

For your purposes you'd need something like:
Code:
Sub Demo()
ActiveDocument.AttachedTemplate.BuildingBlockEntries.Add _
  Name:="WEL", Type:=wdTypeAutoText, Category:="General", Range:=Selection.Range
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote