View Single Post
 
Old 02-09-2014, 03:06 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Here is an adaptation of Paul's code that should work with a named autotext entry stored in the document's attached template:
Code:
Private Sub CheckBox1_Click()
  If CheckBox1.Value = True Then
    Call UpdateBookmark("Destination", "ATEntry" & vbCr)
  Else
    Call UpdateBookmark("Destination")
  End If
End Sub
 Sub UpdateBookmark(BmkNm As String, Optional strATName As String)
Dim BmkRng As Range
With ActiveDocument
  If .Bookmarks.Exists(BmkNm) Then
    Set BmkRng = .Bookmarks(BmkNm).Range
    If strATName <> vbNullString Then
       Set BmkRng = ActiveDocument.AttachedTemplate.AutoTextEntries(strATName).Insert(Where:=BmkRng)
    Else
      BmkRng.Text = vbNullString
    End If
    .Bookmarks.Add BmkNm, BmkRng
  End If
End With
Set BmkRng = Nothing
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote