HELP....Page Number Update Macro

  • Thread starter kbrad28 via OfficeKB.com
  • Start date
K

kbrad28 via OfficeKB.com

Hello,

I am in search of a macro that updates the page numbers of my document
after a mail merge.
I found a code that would do this several months back, but I have since lost
it after my computer crashed and I have no clue on where I found it. I am
hoping someone here my have the code or something similar to it.

To better describe what the macro did; I would create a letter mail merge,
but every new record reset back to 1, but with the macro code I am looking
for actually placed my document in sequential order(ie.1,2,3,etc.) If someone
out there knows what I am talking be please respond. I will apprectiate any
help on this. Thanks a lot!!


Kbrad28
 
D

Doug Robbins - Word MVP

Use a { Section } field instead of a { Page Field }

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

If you Press Alt+F9, in your document where the page number appears, you
will see { PAGE } Replace that with { SECTION } then press Alt+F9 to toggle
off the field codes.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

kbrad28 via OfficeKB.com said:
Thanks for your response, but could you explain how I go about using a
{section} field. I am a beginner in doing this. Thanks again!
Use a { Section } field instead of a { Page Field }
[quoted text clipped - 14 lines]
 
K

kbrad28 via OfficeKB.com

Thanks, I will try that and let you know how it goes.
If you Press Alt+F9, in your document where the page number appears, you
will see { PAGE } Replace that with { SECTION } then press Alt+F9 to toggle
off the field codes.
Thanks for your response, but could you explain how I go about using a
{section} field. I am a beginner in doing this. Thanks again!
[quoted text clipped - 6 lines]
 
K

kbrad28 via OfficeKB.com

Eureka!!! Everything works as it should. Thanks!
If you Press Alt+F9, in your document where the page number appears, you
will see { PAGE } Replace that with { SECTION } then press Alt+F9 to toggle
off the field codes.
Thanks for your response, but could you explain how I go about using a
{section} field. I am a beginner in doing this. Thanks again!
[quoted text clipped - 6 lines]
 
K

kbrad28 via OfficeKB.com

One issue, the { SECTION } works, but if one of my letters run longer then
one page it doesn't go to the next number it stays at page one, how do I go
about to correct this?
If you Press Alt+F9, in your document where the page number appears, you
will see { PAGE } Replace that with { SECTION } then press Alt+F9 to toggle
off the field codes.
Thanks for your response, but could you explain how I go about using a
{section} field. I am a beginner in doing this. Thanks again!
[quoted text clipped - 6 lines]
 
D

Doug Robbins - Word MVP

In that case, revert to the use of the { PAGE } field for the page numbers,
and execute the merge to a new document and then run the following macro on
that document

Dim i As Long
With ActiveDocument
For i = 2 To .Sections.Count
.Sections(i).Headers(wdHeaderFooterPrimary).PageNumbers.RestartNumberingAtSection
= False
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

kbrad28 via OfficeKB.com said:
One issue, the { SECTION } works, but if one of my letters run longer
then
one page it doesn't go to the next number it stays at page one, how do I
go
about to correct this?
If you Press Alt+F9, in your document where the page number appears, you
will see { PAGE } Replace that with { SECTION } then press Alt+F9 to
toggle
off the field codes.
Thanks for your response, but could you explain how I go about using a
{section} field. I am a beginner in doing this. Thanks again!
[quoted text clipped - 6 lines]
 
K

kbrad28 via OfficeKB.com

Thanks so much Mr. Robbins for your responses! I just have one more question.
Is it possible to format a macro to use a specific font, size, color, etc?
In that case, revert to the use of the { PAGE } field for the page numbers,
and execute the merge to a new document and then run the following macro on
that document

Dim i As Long
With ActiveDocument
For i = 2 To .Sections.Count
.Sections(i).Headers(wdHeaderFooterPrimary).PageNumbers.RestartNumberingAtSection
= False
Next i
End With
One issue, the { SECTION } works, but if one of my letters run longer
then
[quoted text clipped - 12 lines]
 
D

Doug Robbins - Word MVP

font name, size and color are not characteristics of a macro, they are
charactistics of characters. You can certainly use a macro to apply such
characteristics. The following code will apply the font, size and color
indicated to the text that is selected:

With Selection.Font
.Name = "Arial"
.Size = 24
.Color = wdColorBrightGreen
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

kbrad28 via OfficeKB.com said:
Thanks so much Mr. Robbins for your responses! I just have one more
question.
Is it possible to format a macro to use a specific font, size, color, etc?
In that case, revert to the use of the { PAGE } field for the page
numbers,
and execute the merge to a new document and then run the following macro
on
that document

Dim i As Long
With ActiveDocument
For i = 2 To .Sections.Count

.Sections(i).Headers(wdHeaderFooterPrimary).PageNumbers.RestartNumberingAtSection
= False
Next i
End With
One issue, the { SECTION } works, but if one of my letters run longer
then
[quoted text clipped - 12 lines]
 
K

kbrad28 via OfficeKB.com

Thanks this is exactly what I was looking for. Everything works!! Thank you.
font name, size and color are not characteristics of a macro, they are
charactistics of characters. You can certainly use a macro to apply such
characteristics. The following code will apply the font, size and color
indicated to the text that is selected:

With Selection.Font
.Name = "Arial"
.Size = 24
.Color = wdColorBrightGreen
End With
Thanks so much Mr. Robbins for your responses! I just have one more
question.
[quoted text clipped - 20 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top