Hi all - I have several documents that I need to merge together. The merging works fine, but I need to update the page number in each page footer after I am done (the page number and the total page count is stored in 2 table cells in the footer, see attached image - if the document has ten pages and you are on the third page, the first cell will read "3", the second will read "10", etc).
Now, something like the code below works if I put in a loop, but I only if I create a section break on each page (also I have to de-link the footers which is pain).
Code:
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).range.Tables(1).Cell(1, 1).Range = "3"
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).range.Tables(1).Cell(1, 2).Range = "10"
ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary).range.Tables(1).Cell(1, 1).Range = "4"
ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary).range.Tables(1).Cell(1, 2).Range = "10"
I'm sure there's a better way to do this, anyone have any suggestions? (Note, I have to keep the table cells, those are not allowed to change)