View Single Post
 
Old 09-22-2017, 05:46 PM
emblackett emblackett is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2017
Posts: 2
emblackett is on a distinguished road
Default Recording code to create Autotext entries

Hi,
I tried to record a macro in Word 2016 to create autotext entries. I recorded the following steps:
1. Click Insert tab
2. Select Quick Parts / Autotext
3. Type a name for the entry
4. Click OK

When I looked in the code window nothing had been recorded, only the name of the macro at the beginning Sub macro1() and then Sub End. Can anyone explain why no code would be recorded, the document was saved as a Word macro enabled template

I repeated the recording using ALT+ F3 instead of ribbon clicks, to bring up the dialog box, and entered the autotext name. This code (below) was recorded and the autotext entry was made.

Sub Macro3()
'
' Macro3 Macro
'
'
ActiveDocument.AttachedTemplate.BuildingBlockEntri es.Add Name:="WEL", _
Range:=Selection.Range
End Sub

I then deleted the new entry from autotext and tested the macro, but it goes into debug. Can anyone help?

Thanks
Liz
Reply With Quote