Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 02-09-2014, 03:06 PM
gmaxey gmaxey is offline How do i insert autotext using a contol toolbox checkbox Windows 7 32bit How do i insert autotext using a contol toolbox checkbox 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i insert autotext using a contol toolbox checkbox Autotext jafrapatty Word 2 05-09-2014 04:30 AM
How do i insert autotext using a contol toolbox checkbox Word 2003 Document Opens In control toolbox Edit Mode rangasamy007 Word 1 09-16-2011 04:12 AM
AutoText question harbor11 Word 0 12-16-2009 09:42 AM
Control Toolbox tjc154 Word 0 03-29-2009 07:13 PM
Excel ->VB code for Checkbox (control toolbox) kirkstyle Excel 0 08-16-2006 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft