Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-13-2022, 01:08 PM
nyconfidential nyconfidential is offline Updating page number in table cells in footer in each page Windows 10 Updating page number in table cells in footer in each page Office 2019
Novice
Updating page number in table cells in footer in each page
 
Join Date: Nov 2021
Posts: 4
nyconfidential is on a distinguished road
Default Updating page number in table cells in footer in each page

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)
Attached Images
File Type: png word page.PNG (564 Bytes, 12 views)
Reply With Quote
 

Tags
footers, page numbers, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating page number in table cells in footer in each page Page number shows up as { PAGE } instead of number and question about area allowed for footer dw85745 Word 3 01-16-2022 03:19 PM
Table of content to include a page number comprising Section and page number Allen001 Word 2 11-25-2019 05:38 AM
Don't want page number or date in footer on first page, do want graphic in header. dianahbr Word 2 02-23-2018 09:25 AM
Updating page number in table cells in footer in each page Table adding cells to previous page with room still on current page. gedet Word 1 01-03-2018 10:35 AM
Updating page number in table cells in footer in each page Total Page number incorrect in the first page footer mmathisekar Word 11 06-16-2016 06:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft