![how to center text in word at the center of the page how to center text in word at the center of the page](https://www.simuldocs.com/wp-content/uploads/2021/06/How-to-center-text-in-a-table-in-Microsoft-Word-1.png)
What this will do is – sorry, what was that? Wow you’re right: that displays page numbers as lowercase Roman numerals. ObjDoc.Sections(1).Footers(1).PageNumbers.NumberStyle = wdPageNumberStyleLowercaseRoman The following script defines a constant named wdPageNumberStyleLowercaseRoman and then assigns that constant to the NumberStyle property: Const wdAlignPageNumberCenter = 1Ĭonst wdPageNumberStyleLowercaseRoman = 2 (For more information, check out the Microsoft Word VBA Language Reference on MSDN.) Just to whet your appetite, however, we’ll give you one example. Of course, there are plenty of other options we can apply to page numbers, far more than we can cover in this one column. At the same time, we’re calling the Add method to add page numbers to the footer, passing along the constant wdAlignPageNumberCenter to indicate that we want the page numbers centered.
![how to center text in word at the center of the page how to center text in word at the center of the page](https://www.howtogeek.com/wp-content/uploads/2016/01/04_clicking_layout_tab.png)
What we’re doing here is creating a PageNumbers object tied to the first footer in the first, and only, section of our document that’s what objDoc.Sections(1).Footers(1) is all about. Once we’ve done that we can add the page numbers with a single line of code: objDoc.Sections(1).Footers(1).PageNumbers.Add(wdAlignPageNumberCenter)
![how to center text in word at the center of the page how to center text in word at the center of the page](https://cdn.extendoffice.com/images/stories/doc-word/center-text-on-page/doc-center-text-4.png)
What if we change our mind and decide that we don’t want the page number centered? That’s OK we can use any of the following constants and their values:Īfter defining our constant we use these three lines of code, which create a visible instance of the Word.Application object and then give us a new, blank document to work with: Set objWord = CreateObject(“Word.Application”) Yes, it is a simple little script, isn’t it? We start out by defining a constant named wdAlignPageNumberCenter and setting the value to 1 this tells the script that we want the page number centered within the footer. ObjDoc.Sections(1).Footers(1).PageNumbers.Add(wdAlignPageNumberCenter) Set objWord = CreateObject(“Word.Application”) Instead, the best we can do is offer you a script that puts the page number (centered) in the footer of a Word document: Const wdAlignPageNumberCenter = 1 So, no, AW, we don’t have any suggestions for you we don’t do suggestions. After being chewed out by the person who sent the email (“A lot of people put a lot of time and effort into this project and all you can do is find things that are wrong with it!”) and that person’s manager and his manager (“You should know better than to give her any suggestions”), this particular Scripting Guy vowed never to make another suggestion as long as he lived, a vow he has stuck to for nearly three years now.Īlso a vow which, interestingly enough, hasn’t seemed to upset anyone else in the least. That’s because of an incident that occurred a few years ago, when someone he works with sent out a blanket email about their latest project, adding, “Please let me know if you have any suggestions on how we can make this even better.” Being a bit naïve in the ways of the world, our hero actually had a couple suggestions, so he helpfully forwarded those along. To tell you the truth, the Scripting Guy who writes this column no longer makes suggestions.
![how to center text in word at the center of the page how to center text in word at the center of the page](https://oneminuteofficemagic.files.wordpress.com/2016/12/word-page-centering-20161209-3-copy.png)
Do you have any suggestions on how I can do that? Hey, Scripting Guy! I need to put the page number (centered) in the footer of a Word document.