cancel
Showing results for 
Search instead for 
Did you mean: 

How to read header and footer for the second page and third page of word docuemnt

HarishM2
Level 6
HI,

 How Can I read the  header or footer in 2nd page or 3rd page or 4th page...... in header or footer of ms word document?.


If it is first page I can read using  Footer action in Ms wordbut not able to read  footer text in any further pages?

------------------------------
Harish
RPA Developer
------------------------------
3 REPLIES 3

Hi Harish

I'm not sure if this is something you would be able to do as the footers are linked. If you updated the text in the footer on page one the text is updated for the footers on all additional pages so you should only need to get the text from page one.

------------------------------
Michael ONeil
Technical Lead developer
Everis Consultancy
Europe/London
------------------------------

Thanks Michael for responding.

Yes you are right if it is just text that works but what I'm looking is to get page numbers in second page and 3rd page . Because some of the word document page number will start after certain page. I did tried  converting word to other formats like html, xml but it turns out even page numbers are not displayed in the word it is giving some page numbers.

------------------------------
Harish
RPA Developer
------------------------------

Hi Harish

To read the page numbers you would likely need to create a specific code object for this. You can use the pagenumbers object actions for this have a look at the link below which should point you in the right direction.

https://docs.microsoft.com/en-us/office/vba/api/word.pagenumber

Good luck 🙂

------------------------------
Michael ONeil
Technical Lead developer
Everis Consultancy
Europe/London
------------------------------