![]() |
|
#3
|
|||
|
|||
|
If you have Option Explicit at the top of your code pane you should be getting a “Compile Error” variable not defined on ContentControl.If you don’t then you must be getting a run-time error “424” on the If .Title = “Grade” Then line.
That, or there is more to your code than meets to the eye. You mention bookmark BM2 in your post but there is no reference to a bookmark named “BM2” or anything else related to a bookmark in your code. Code:
Private Sub Paragraph_Addition()
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 = "Please delete all content for Benchmark team."
Case Else
strDetails = vbNullString
End Select
'Write to bookmark
If ActiveDocument.Bookmarks.Exists("BM2") Then
Set oRng = ActiveDocument.Bookmarks("BM2").Range
oRng.Text = strDetails
ActiveDocument.Bookmarks.Add "BM2", oRng
End If
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Multiple Choice Drop Down List
|
teza2k06 | Word | 1 | 04-29-2014 04:54 PM |
| Populate a table based on choices from drop down menu | Xaand | Word VBA | 0 | 02-25-2014 11:08 AM |
Design: Adding text choice
|
christopherL | Word | 2 | 10-07-2013 11:22 PM |
Bookmark applied to drop-down list doesn't do the job
|
thecreaser | Word | 5 | 04-11-2013 04:21 AM |
| Adding Macro menu to the right click menu (Word 2007) | masam123 | Word | 0 | 10-14-2011 04:05 AM |