Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2021, 12:51 PM
ilcaa72 ilcaa72 is offline Return Footer or Header Page Number Windows 7 64bit Return Footer or Header Page Number Office 2013
Novice
Return Footer or Header Page Number
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default Return Footer or Header Page Number

hello, what is the proper VBA syntax to return the footer or header page number (i do not know ahead of time where it will be located. i can take care of the logic, i just need the object.method call to return footer/header page number)

i tried , but this returns the sequential page number not the page number listed in Document at the footer or header (some documents will have a Preface with roman numerals so i need to be able to identify this). thanks



HTML Code:
' only returns sequenced page #, i want the page number in footer or header
CurPage = Selection.Range.Information(wdActiveEndPageNumber)
Reply With Quote
  #2  
Old 06-22-2021, 01:55 PM
rollis13's Avatar
rollis13 rollis13 is offline Return Footer or Header Page Number Windows 10 Return Footer or Header Page Number Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

Just to add missing crosspost link: LINK
Reply With Quote
  #3  
Old 06-22-2021, 03:30 PM
ilcaa72 ilcaa72 is offline Return Footer or Header Page Number Windows 7 64bit Return Footer or Header Page Number Office 2013
Novice
Return Footer or Header Page Number
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default

thanks, i forgot to add that
Reply With Quote
  #4  
Old 06-22-2021, 04:52 PM
Guessed's Avatar
Guessed Guessed is offline Return Footer or Header Page Number Windows 10 Return Footer or Header Page Number Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm not sure there is a simple method. You could use the constant that returns the arabic number for that section
Selection.Range.Information(wdActiveEndAdjustedPageNumber)

Do you want the formatted page number (what a field would return if it had no switches added) or an Arabic number? It could be alphabetic or roman numerals for instance.

I think it takes a lot of code to work out the applicable header/footer contents and would probably be easier to insert a Page Field on the page and get that value. A H/F might be linked to preceding H/F and pagenum fields can be in floating text boxes - it gets very ugly to query that info.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 06-22-2021, 08:09 PM
ilcaa72 ilcaa72 is offline Return Footer or Header Page Number Windows 7 64bit Return Footer or Header Page Number Office 2013
Novice
Return Footer or Header Page Number
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default

I ran macros on only numbered pages with integer values, 1,2,3 etc... so i need the macros to skip any pages with roman numerals, or no page numbers. so i want to return the footer or header and see if there is a integer page number, if so run number
Reply With Quote
Reply

Tags
footer and header, word vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Return Footer or Header Page Number Return Page Number of Paragraph Number SamDsouza Word VBA 4 03-04-2021 09:37 PM
Different header and footer for first and second page Maupiti Word 2 02-08-2021 05:44 PM
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
Return Footer or Header Page Number begin each section with page 1 in header PLUS continuous page numbering in footer onemorecupofcoffee Word 18 09-04-2013 04:31 PM
How to save the current page in a new file with all the page settings (header, footer Jamal NUMAN Word 6 03-15-2012 03:27 PM

Other Forums: Access Forums

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


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