View Single Post
 
Old 08-26-2021, 09:15 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 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