Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-26-2021, 09:15 PM
gmayor's Avatar
gmayor gmayor is offline Bookmarks vs Fields Windows 10 Bookmarks vs Fields Office 2019
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

The optimum approach is to use content controls to accept the data as they are much more robust than bookmarks. For a text content control the following can be used to write a value from your userform to the appropriate control. Where there is no datato write to a control set the strValue to ChrW(8203) i.e. a zero length space.
Code:
Public Sub FillCC(strCCTitle As String, strValue As String)
Dim CCtoFillRng As Range
    Set CCtoFillRng = ActiveDocument.SelectContentControlsByTitle(strCCTitle).Item(1).Range
    CCtoFillRng.Text = strValue
lbl_Exit:
    Set CCtoFillRng = 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
Bookmarks vs Fields Deleting only all bookmarks contents not the bookmarks adilprodigy Word VBA 1 10-11-2017 01:31 PM
Bookmarks vs Fields Form fields and bookmarks restrictions AttiCuS Word VBA 11 04-19-2016 02:40 AM
Bookmarks vs Fields Form updating Bookmarks - writes to the bookmarks multiple times PeterPlys Word VBA 13 01-14-2015 06:41 AM
Bookmarks vs Fields How To Find Bookmarks and/or custom fields Inside Building Blocks, Office 2010 thpanos Word 3 02-17-2013 08:49 AM
autopopulating REF fields + bookmarks valz Word 10 09-01-2011 08:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:03 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