![]() |
|
#4
|
|||
|
|||
|
You could put your header merge field in a richtext CC titled "Ref"
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oSec As Section
Dim oCC As ContentControl, oCC2 As ContentControl
For Each oSec In ActiveDocument.Sections
Set oCC = oSec.Headers(wdHeaderFooterPrimary).Range.ContentControls(1)
For Each oCC2 In oSec.Range.ContentControls
If oCC2.Title = "ref_no" Then
oCC2.Range.Text = oCC.Range.Text
'If there is only one "ref_no" CC per section then:
'Exit For
End If
Next
Next
lbl_Exit:
Exit Sub
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Populating Tables with data when available only - Using Mail merge
|
stevejohhnym | Mail Merge | 1 | 06-25-2019 12:50 AM |
Delete or merge Content controls with the same name
|
sylvio | Word VBA | 9 | 08-30-2017 01:46 AM |
| Macro to save docx to doc that checks compatibility and converts content controls to static content. | staicumihai | Word VBA | 4 | 10-12-2016 08:23 PM |
Inserting multiple content controls for a date
|
jeffreybrown | Word | 2 | 05-09-2016 05:53 PM |
| Mail Merge Field Not Populating | JennEx | Mail Merge | 3 | 05-10-2015 09:30 PM |