Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub AddAutoText()
Dim intTemplate As Integer
Dim strAutoTextName As String
strAutoTextName = "MyAutoText"
' Find AutoText insertion point (before specific text)
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Insert before this text"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.MoveLeft unit:=wdCharacter, Count:=1
' Make sure template is found and AutoText is there so no error occurs
For intTemplate = 1 To Application.Templates.Count
If Application.Templates(intTemplate).Name = "My Template.dot" Then
Application.Templates(intTemplate).AutoTextEntries(strAutoTextName).Insert Where:=Selection.Range
Exit For
End If
Next intTemplate
End Sub