Thread: [Solved] Setting page numbers
View Single Post
 
Old 11-20-2024, 06:11 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by Bikram View Post
If we adjust the pagenumber manually the problem doesn't exist. But if we attempt it with code the first page header will be expanded and a paragraph will appear. Is there a way to change the page numbers without causing expansion of Header in the first page?

I have attached the snipped images of before and after running the code. Please have a look.
The issue is a result of your code. Until you ran your code that header did not exist. The empty header was created because your code uses the Selection object. This is one of the many reasons why use of the Selection should be avoided. Instead, you should access the objects directly, as demonstrated in the answer from macropod.
Reply With Quote