Please note, the notification system in the Community is partially broken
You might not receive an email informing you that there is a new reply in a thread you are following. We are working on fixing this as fast as possible. Please make sure to periodically check the conversation to see if there are any updates.
October 31, 2024
Please note, the notification system in the Community is partially broken
You might not receive an email informing you that there is a new reply in a thread you are following. We are working on fixing this as fast as possible. Please make sure to periodically check the conversation to see if there are any updates.
You can use a 'ContentControlOnExit' macro in the document's 'ThisDocument' module for this. the following code shows how you might implement this with a checkbox titled 'MyCheckBox' and a bookmark named 'Destination' in the document.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
If ContentControl.Title = "MyCheckBox" Then
If ContentControl.Checked = True Then
Call UpdateBookmark("Destination", "Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus." & vbCr)
Else
Call UpdateBookmark("Destination", "")
End If
End If
End Sub
Sub UpdateBookmark(BmkNm As String, NewTxt As String)
Dim BmkRng As Range
With ActiveDocument
If .Bookmarks.Exists(BmkNm) Then
Set BmkRng = .Bookmarks(BmkNm).Range
BmkRng.Text = NewTxt
.Bookmarks.Add BmkNm, BmkRng
End If
End With
Set BmkRng = Nothing
End Sub
Note that, if the checkbox is unchecked after checking, the inserted content is deleted.
Cheers Paul Edstein (Fmr MS MVP - Word)
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.