![]() |
|
|
|
#1
|
||||
|
||||
|
Try Code:
Sub CCLoader()
Dim aCC As ContentControl, aRng As Range
For Each aRng In ActiveDocument.StoryRanges
For Each aCC In aRng.ContentControls
If aCC.Title = "aaa" Then
aCC.Range.Text = "hi mum"
End If
Next aCC
Next aRng
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#2
|
|||
|
|||
|
Thank you, Andrew - works everywhere except the header.... I haven't tried the footer though.
How is the header differentiated here ? How do we access it for updating ? Thanks! |
|
#3
|
|||
|
|||
|
PS -
Each of the controls for "AccountName" are bounding boxes. I ensure they are unlocked: Still no luck with anything in the Page Headers. I do have Initial Page Header set to none, so the page header resides in another section, if that makes a difference. Sub CCLoaderHiMum() Dim aCC As ContentControl, aRng As Range For Each aRng In ActiveDocument.StoryRanges For Each aCC In aRng.ContentControls If aCC.Title = "AccountName" Then aCC.LockContents = False aCC.Range.Text = "hi mum" aCC.Range.Font.ColorIndex = wdBlack aCC.LockContents = True End If Next aCC Next aRng End Sub |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
VBA to set Content controls as non printing
|
Sammie0Sue | Word VBA | 21 | 01-12-2021 04:44 PM |
| VBA for content controls | ciresuark | Word VBA | 1 | 03-10-2015 03:14 PM |
| Calculate Age From Content Controls | kintap | Word VBA | 10 | 07-02-2014 09:25 AM |
| Windows update loop | franklekens | Windows | 0 | 04-10-2014 11:56 PM |
Content Controls
|
Sammie0Sue | Word | 6 | 11-06-2013 10:56 PM |