01-21-2021, 08:29 AM
somethings need to beĀ in a VARIANT
this works not sure if it is 100% correct.
Macro Macro36
Trigger Aw
this works not sure if it is 100% correct.
Macro Macro36
Trigger Aw

Word.Range rng=doc.Sections.Item(1).Footers.Item(wdHeaderFooterPrimary).Range
rng.Text="page "
VARIANT FieldPage=wdFieldPage
VARIANT Direction=wdCollapseEnd
VARIANT FieldNumPages=wdFieldNumPages
rng.SetRange(rng rng)
rng.Collapse(Direction)
rng.Fields.Add(rng FieldPage)
rng.Collapse(Direction)
rng.SetRange(rng rng)
rng.InsertAfter(" of ")
rng.SetRange(rng rng)
rng.Collapse(Direction)
rng.Fields.Add(rng FieldNumPages)
rng.Collapse(Direction)
rng.SetRange(rng rng)
rng.InsertAfter(" Total ")
rng.SetRange(rng rng)
rng.Collapse(Direction)
doc.Sections.Item(1).Footers.Item(wdHeaderFooterPrimary).Range.Fields.Update
doc.Sections.Item(1).Footers.Item(wdHeaderFooterPrimary).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter