![]() |
|
#2
|
||||
|
||||
|
The following will do what you ask:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim strDetails As String
Dim oCC As ContentControl
Dim oRng As Range
Set oCC = ActiveDocument.SelectContentControlsByTitle("Grade").Item(1)
Select Case oCC.Range.Text
Case "LOW"
strDetails = "7.1.5 Umbrella Insurance with a minimum limit of not less than $2,000,000 per" & vbCr & _
" occurrence."
Case "MINIMAL"
strDetails = " "
End Select
If ActiveDocument.Bookmarks.Exists("BM7") Then
Set oRng = ActiveDocument.Bookmarks("BM7").Range
oRng.Text = strDetails
oRng.Bookmarks.Add "BM7"
Set oRng = ActiveDocument.Bookmarks("BM7").Range
With oRng.Find
Do While .Execute("Umbrella Insurance")
oRng.Font.Underline = wdUnderlineSingle
Exit Do
Loop
End With
Set oRng = ActiveDocument.Bookmarks("BM7").Range
With oRng.Find
Do While .Execute("2,000,000")
oRng.Font.Bold = True
Exit Do
Loop
End With
Set oRng = ActiveDocument.Bookmarks("BM7").Range
With oRng.Find
Do While .Execute("7.1.5")
oRng.Font.Bold = True
Exit Do
Loop
End With
End If
lbl_Exit:
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 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting and Inserting in Track Change doesnt work | balaji.c | Word | 10 | 01-02-2014 12:14 AM |
| Powerpoint save as WMV but media doesnt work. | hooney | PowerPoint | 0 | 02-21-2013 09:45 PM |
| Safe Senders Doesnt work | Anil Kaul | Outlook | 0 | 11-16-2012 01:28 PM |
Command Button doesnt work on network
|
rmw85 | Word VBA | 1 | 04-25-2012 01:02 PM |
My Product code doesnt work!!!! PLEASE HELP
|
dukquaknoobhack | Office | 1 | 01-05-2012 03:43 PM |