Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 01-24-2019, 10:01 PM
gmayor's Avatar
gmayor gmayor is offline When check box is selected, need text to be written on bookmark Windows 10 When check box is selected, need text to be written on bookmark Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Another way is to use the following macro to write your values to the bookmarks
You can then call it from your form e.g.
Code:
FillBM "bmDate", txtDate.Value
FillBM "bmName", txtName.Value
This ensures that the text is written IN the bookmark rather than AT it, thus enabling the values to be recalled to the userform should you wish to recall the userform to edit the document.
For optional insertions
Code:
If chckIEP.Value = True Then
    FillBM "bmIEP", "Request IEP"
Else
    FillBM "bmIEP", ""
End If
Code:
Public Sub FillBM(strbmName As String, strValue As String)
'Graham Mayor - http://www.gmayor.com
Dim orng As Range
    With ActiveDocument
        On Error GoTo lbl_Exit
        Set orng = .Bookmarks(strbmName).Range
        orng.Text = strValue
        orng.Bookmarks.Add strbmName
    End With
lbl_Exit:
    Set orng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any efficient way to lock text that’s always written in a certain format? Gilvv Word 25 11-25-2018 04:52 PM
Macro to insert different sets of text at bookmark depending on sequence of selected check boxes chipper09 Word VBA 0 06-21-2018 01:49 PM
When check box is selected, need text to be written on bookmark Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word marksm33 Word VBA 3 01-15-2015 07:55 PM
When check box is selected, need text to be written on bookmark Getting mult resps. selected in listbox to concatenate & paste at a bookmark in Word marksm33 Word VBA 3 01-15-2015 05:59 PM
Animation: text appears as if written by pen ionas.iona PowerPoint 0 03-31-2011 05:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:20 PM.


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