Forum Discussion
Lance_Kester
May 03, 2022Copper Contributor
Making a document number appear in several places
Hi I've created a Word template and used a macro to insert a document number which increases sequentially each time a new document is created from the template. This works fine, but I need to make t...
Lance_Kester
May 04, 2022Copper Contributor
Doug_Robbins_Word_MVP Many thanks for the prompt reply Doug. The code and field work fine in the document, but I can't get the DOCVARIABLE field to work if it's embedded in the header. Is there any way of doing this?
Regards
Lance Kester
May 05, 2022
Use
Dim i as Long, j as Long
With ActiveDocument
.Variables("DocNum").Value = docnumber
.Range.Fields.Update
For i = 1 to .Sections.Count
With Sections(i)
For j = 1 to .Headers.Count
.Headers(j).Range.Fields.Update
Next j
End With
Next i
End With
- Lance_KesterMay 09, 2022Copper ContributorThank you Doug, apologies for not replying sooner!