Page Number macro for Word 2010 and Personal Book Files

Page 1 of 1 (10 items)
This post has 9 Replies | 2 Followers

Posts 3150
Forum MVP
Dominick Sela | Forum Activity | Posted: Sat, Jul 16 2011 10:48 AM | Locked

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 Wink.

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!

Posts 3150
Forum MVP
Dominick Sela | Forum Activity | Replied: Sat, Jul 16 2011 10:49 AM | Locked

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?

Posts 3150
Forum MVP
Dominick Sela | Forum Activity | Replied: Sat, Jul 16 2011 11:04 AM | Locked

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!

5315.Personal Book Macros.zip

Posts 61
David Sawyer | Forum Activity | Replied: Sat, Jul 16 2011 12:55 PM | Locked

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!

 

Posts 3150
Forum MVP
Dominick Sela | Forum Activity | Replied: Sat, Jul 16 2011 1:10 PM | Locked

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... 

Posts 17
Chris | Forum Activity | Replied: Sat, Jul 30 2011 10:01 PM | Locked

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?

Posts 3150
Forum MVP
Dominick Sela | Forum Activity | Replied: Sun, Jul 31 2011 5:03 AM | Locked

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!

Posts 135
Mikko Paavola | Forum Activity | Replied: Fri, Sep 2 2011 9:12 AM | Locked

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.

 

Lutheran Gold, Gold (IH), Scholar's Silver (JG), Nelson Bible Reference Bundle, Luther's Works, etc.
Laptop: Win 8 Pro 64bit, Intel Core2Duo T8100 2.1GHz, 4GB RAM, 128GB SSD, ATI HD3470 256MB.
Tablet: iPad2 16GB. Phone: Nokia Lumia 820.

Posts 8
Justin Ashurst | Forum Activity | Replied: Wed, Nov 30 2011 11:30 AM | Locked

this is awesome!  Thanks!

Posts 0
Chris Haerringer | Forum Activity | Replied: Mon, Apr 2 2012 10:54 AM | Locked

Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Page 1 of 1 (10 items) | RSS