Page Number macro for Word 2010 and Personal Book Files
Attached find a macro file I wrote for adding a Personal Book field, of form [[Page:XX]], at the top of each page of your Personal Book file! Please feel free to try it out, it's in the attached zip file.
Note: If you have not enabled Macros in Word 2010, you can Google how to do it or check this site out.
Once macros are enabled on your copy of Word 2010, here are the Instructions on trying this out:
1. Take File and Save it to your Word Startup folder. On my PC it is:
C:\Users\<UserName>\AppData\Roaming\Microsoft\Word\STARTUP
(You can verify the location in Word 2010 by checking File/Options/Advanced/File Locations (button), then see what path it says for "Startup"
2. Run Word 2010. Go to View, click on the Macros button, You should see two Macros, "ClearPageFields" and "NextPage". If you want to see the code I wrote, click the macro name and then click Edit. But the important thing is, if you see those two names, you have the macros installed into Word!
The two macros are these:
ClearPageFields: will clear out ALL page fields in your file.
NextPage: Clears any PageField notations, then adds a new page field in the form [[Page:XX]] at the beginning of each page.
3. Close the Macro dialog box for now, and Open up your source PB file (File/Open).
4. Run the macros!
Important Notes:
1. These macros rely on the background re-pagination of the document as the page number fields are inserted (ie, depending on the size of your document, the number of pages grows). I suspect that depending on your document there may be times when the background re-pagination does not finish, and the [Page:XX]] gets put in the wrong place. Let me know if you see this, my computers are too fast to detect this [;)].
2. If you run one of these macros and want to revert your document back to a state prior to running the macro, or (heaven forbid!) the macro does something messy, just hit Ctrl-Z to Undo and revert back!
3. Tested on Windows 7 and Word 2010 only. I don't think I use anything that won't work in Word 2007, maybe 2003? Let me know but no guarantees.
4. Use at your own risk!
5. If you see a problem or want to request an enhancement, PLEASE post a Personal Book source document if appropriate that shows the problem/enhancement, as an attachment in a zip file. It will be much easier for me to fix.
Enjoy and hope it helps!
Comments
-
I forgot to say - what I did, was played around with the font size of my source document (Select All, and press the Increase or decrease all fonts buttons), to get what looks like an appropriate page size in Logos. Then the auto-generate of Page Numbers will be easy, and any you added before will be cleared first. Does that make sense?
0 -
Sorry for the update, use this one - fixed a small problem that no one will likely see, and I believe this should work in all Word programs 97-2003 also!
0 -
I knew someone would come up with a Macro for this! By the way I am using this on Mac with Word 2011 and it works perfectly.
I'll try to think of any possible improvements.
Thanks!
0 -
Glad it works on a Mac David!
I am open to try adding other macros too if someone can describe what they would like to have it do. We have a full programming language at our disposal...
0 -
Thanks! It works for me, but I need to make some edits for preface pages. I can't seem to figure out how to see the macro. It keeps telling me it is locked. I am running a Mac OSX 10.7 with Word 2011. Any suggestions?
0 -
Go to the startup folder where you placed the file from Word, and open it just like it was a document. It will "open" it, but what you see still looks like a blank document. But then if you go to View Macros, the Edit button will be enabled. At least it works that way on a Windows computer!
0 -
Hi! I can't install the macro to Word 2003. It seems the file should be in .dot format, not .dotm
Could you make also the .dot version of the macro? I'd love to use it for my PBs that have hundreds of pages.
Faithlife Connect + several Base Packages + Luther's Works, etc.
Lenovo ThinkPad Yoga 260, Win 10 Pro, Intel Core i7-6500U, 16GB RAM, 256GB SSD, Intel HD Graphics 520.
iPhone 11.0 -
this is awesome! Thanks!
0 -
Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0