Hey gang,

Got sort of a unique one. I'll try to explain without getting long-winded.
I have a procedure-type document with page numbering in the Headers. Some
times we need to insert a change to the procedure that forces a new page.
This new page needs to have a ".1" added to the Header page numbering. For
example, if I need to add a new page (section break - next page) between
pages 10 and 11, my page numbering will end up being 10, 10.1, and 11.

I have recorded a macro that has automated the insertion of two section
breaks, turned off "Same as Previous", but I need to do the following:

1. On the new page, change the existing "field" page numbering from the
existing number (in this case 11) to a hard-typed "10.1".
2. On the page that goes back to regular numbering, change it's new number
(12) back to 11.

I know it is quite easy to select the first page number and delete it by
typing the actual page number I want, and going to the next section header
and selecting the page number and changing it to "Start at...11", but I was
hoping I could automate this for my staff (who aren't the most literate of
word-processors)! HA! Sine this new page added could be anywhere, I am
hoping to be able to look at the existing page number and change it to
"Start at..." one less that it shows now. Not sure if this can be done.
Especially with my limited VBA knowledge!

Any ideas would be greatly appreciated. If you want me to post the recorded
code I have for the Section breaks, holler back.

TIA!

--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor - XP
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm

VBA To Change Page Numbering in Header... by lynn

lynn
Mon Oct 18 09:58:37 CDT 2004

Hi Bill
You can determine the current page number using vba and
then use that to update your next section start from page
number.

Dim CurPage
CurPage = Selection.Information
(wdActiveEndAdjustedPageNumber)

This will return the logical page number not a physical
page number. Logical page numbers take into account
manual adjustments made to the document, like your macro
which deletes the page number field and replaces it with
text. Logicially the page is still page 11 but you have
typed in manual text 10.1. So the piece of code above
will return "11".

When you go to your next section heading to change the
page number to start from, you put curPage instead of a
number. So something similar to
Selection.HeaderFooter.PageNumbers.StartingNumber =
CurPage

Hope this helps
Lynn
>-----Original Message-----
>Hey gang,
>
>Got sort of a unique one. I'll try to explain without
getting long-winded.
>I have a procedure-type document with page numbering in
the Headers. Some
>times we need to insert a change to the procedure that
forces a new page.
>This new page needs to have a ".1" added to the Header
page numbering. For
>example, if I need to add a new page (section break -
next page) between
>pages 10 and 11, my page numbering will end up being 10,
10.1, and 11.
>
>I have recorded a macro that has automated the insertion
of two section
>breaks, turned off "Same as Previous", but I need to do
the following:
>
>1. On the new page, change the existing "field" page
numbering from the
>existing number (in this case 11) to a hard-typed "10.1".
>2. On the page that goes back to regular numbering,
change it's new number
>(12) back to 11.
>
>I know it is quite easy to select the first page number
and delete it by
>typing the actual page number I want, and going to the
next section header
>and selecting the page number and changing it to "Start
at...11", but I was
>hoping I could automate this for my staff (who aren't
the most literate of
>word-processors)! HA! Sine this new page added could
be anywhere, I am
>hoping to be able to look at the existing page number
and change it to
>"Start at..." one less that it shows now. Not sure if
this can be done.
>Especially with my limited VBA knowledge!
>
>Any ideas would be greatly appreciated. If you want me
to post the recorded
>code I have for the Section breaks, holler back.
>
>TIA!
>
>--
>Bill Foley, Microsoft MVP (PowerPoint)
>Microsoft Office Specialist Master Instructor - XP
>www.pttinc.com
>Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
>Check out Word FAQs at:
http://word.mvps.org/FAQs/General/index.htm
>
>
>.
>

Re: VBA To Change Page Numbering in Header... by Bill

Bill
Mon Oct 18 10:21:56 CDT 2004

Thanks! At least this means that it is possible. Now, if I could just
figure out how to do it! HA! I'll take a look at this code and see if I
can figure out a way to code it to work. I know I learn more by using the
"trial-and-error" method and since this seems doable, I'm diving in!

I'll holler back with my code sample if I start drowning (which I'm sure I
will)! HA!

--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor - XP
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm

"lynn taylor" <lynn.taylor@linklaters.com> wrote in message
news:14b201c4b522$f28f7560$a301280a@phx.gbl...
> Hi Bill
> You can determine the current page number using vba and
> then use that to update your next section start from page
> number.
>
> Dim CurPage
> CurPage = Selection.Information
> (wdActiveEndAdjustedPageNumber)
>
> This will return the logical page number not a physical
> page number. Logical page numbers take into account
> manual adjustments made to the document, like your macro
> which deletes the page number field and replaces it with
> text. Logicially the page is still page 11 but you have
> typed in manual text 10.1. So the piece of code above
> will return "11".
>
> When you go to your next section heading to change the
> page number to start from, you put curPage instead of a
> number. So something similar to
> Selection.HeaderFooter.PageNumbers.StartingNumber =
> CurPage
>
> Hope this helps
> Lynn
> >-----Original Message-----
> >Hey gang,
> >
> >Got sort of a unique one. I'll try to explain without
> getting long-winded.
> >I have a procedure-type document with page numbering in
> the Headers. Some
> >times we need to insert a change to the procedure that
> forces a new page.
> >This new page needs to have a ".1" added to the Header
> page numbering. For
> >example, if I need to add a new page (section break -
> next page) between
> >pages 10 and 11, my page numbering will end up being 10,
> 10.1, and 11.
> >
> >I have recorded a macro that has automated the insertion
> of two section
> >breaks, turned off "Same as Previous", but I need to do
> the following:
> >
> >1. On the new page, change the existing "field" page
> numbering from the
> >existing number (in this case 11) to a hard-typed "10.1".
> >2. On the page that goes back to regular numbering,
> change it's new number
> >(12) back to 11.
> >
> >I know it is quite easy to select the first page number
> and delete it by
> >typing the actual page number I want, and going to the
> next section header
> >and selecting the page number and changing it to "Start
> at...11", but I was
> >hoping I could automate this for my staff (who aren't
> the most literate of
> >word-processors)! HA! Sine this new page added could
> be anywhere, I am
> >hoping to be able to look at the existing page number
> and change it to
> >"Start at..." one less that it shows now. Not sure if
> this can be done.
> >Especially with my limited VBA knowledge!
> >
> >Any ideas would be greatly appreciated. If you want me
> to post the recorded
> >code I have for the Section breaks, holler back.
> >
> >TIA!
> >
> >--
> >Bill Foley, Microsoft MVP (PowerPoint)
> >Microsoft Office Specialist Master Instructor - XP
> >www.pttinc.com
> >Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
> >Check out Word FAQs at:
> http://word.mvps.org/FAQs/General/index.htm
> >
> >
> >.
> >



Re: VBA To Change Page Numbering in Header... by Bill

Bill
Mon Oct 18 13:17:16 CDT 2004

FYI - I got it to work perfectly, however, I had to make one minor change.
I wasn't having luck automating the changing of Page 10 (field code) to Page
10.1 (manually typing). Since this page number could anywhere it also had
to be determined via code, deleted, then entered manually. OUCH! My head
hurt just trying this.

What I did was inserted the two Section Breaks, went into the Headers,
turned off the "Same As Previous", changed the page number to "Start at...
"CurPage - 1" (actually, CurPage =
Selection.Information(wdActiveEndAdjustedPageNumber) - 1), then went to the
previous header, selected the "Page" code, deleted it, then brought up a
message box telling the user to type in the desired page number (10.1). The
code I used was:

Dim CurPage As Integer
CurPage = Selection.Information(wdActiveEndAdjustedPageNumber) - 1
With Selection.HeaderFooter.PageNumbers
.RestartNumberingAtSection = True
.StartingNumber = CurPage
End With


Not perfect, but it worked! Thanks, Lynn for the support!

--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor - XP
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm

"Bill Foley" <wfoley1@EATSPAMANDDIEtxu.com> wrote in message
news:OJt81YStEHA.2124@TK2MSFTNGP11.phx.gbl...
> Thanks! At least this means that it is possible. Now, if I could just
> figure out how to do it! HA! I'll take a look at this code and see if I
> can figure out a way to code it to work. I know I learn more by using the
> "trial-and-error" method and since this seems doable, I'm diving in!
>
> I'll holler back with my code sample if I start drowning (which I'm sure I
> will)! HA!
>
> --
> Bill Foley, Microsoft MVP (PowerPoint)
> Microsoft Office Specialist Master Instructor - XP
> www.pttinc.com
> Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
> Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm
>
> "lynn taylor" <lynn.taylor@linklaters.com> wrote in message
> news:14b201c4b522$f28f7560$a301280a@phx.gbl...
> > Hi Bill
> > You can determine the current page number using vba and
> > then use that to update your next section start from page
> > number.
> >
> > Dim CurPage
> > CurPage = Selection.Information
> > (wdActiveEndAdjustedPageNumber)
> >
> > This will return the logical page number not a physical
> > page number. Logical page numbers take into account
> > manual adjustments made to the document, like your macro
> > which deletes the page number field and replaces it with
> > text. Logicially the page is still page 11 but you have
> > typed in manual text 10.1. So the piece of code above
> > will return "11".
> >
> > When you go to your next section heading to change the
> > page number to start from, you put curPage instead of a
> > number. So something similar to
> > Selection.HeaderFooter.PageNumbers.StartingNumber =
> > CurPage
> >
> > Hope this helps
> > Lynn
> > >-----Original Message-----
> > >Hey gang,
> > >
> > >Got sort of a unique one. I'll try to explain without
> > getting long-winded.
> > >I have a procedure-type document with page numbering in
> > the Headers. Some
> > >times we need to insert a change to the procedure that
> > forces a new page.
> > >This new page needs to have a ".1" added to the Header
> > page numbering. For
> > >example, if I need to add a new page (section break -
> > next page) between
> > >pages 10 and 11, my page numbering will end up being 10,
> > 10.1, and 11.
> > >
> > >I have recorded a macro that has automated the insertion
> > of two section
> > >breaks, turned off "Same as Previous", but I need to do
> > the following:
> > >
> > >1. On the new page, change the existing "field" page
> > numbering from the
> > >existing number (in this case 11) to a hard-typed "10.1".
> > >2. On the page that goes back to regular numbering,
> > change it's new number
> > >(12) back to 11.
> > >
> > >I know it is quite easy to select the first page number
> > and delete it by
> > >typing the actual page number I want, and going to the
> > next section header
> > >and selecting the page number and changing it to "Start
> > at...11", but I was
> > >hoping I could automate this for my staff (who aren't
> > the most literate of
> > >word-processors)! HA! Sine this new page added could
> > be anywhere, I am
> > >hoping to be able to look at the existing page number
> > and change it to
> > >"Start at..." one less that it shows now. Not sure if
> > this can be done.
> > >Especially with my limited VBA knowledge!
> > >
> > >Any ideas would be greatly appreciated. If you want me
> > to post the recorded
> > >code I have for the Section breaks, holler back.
> > >
> > >TIA!
> > >
> > >--
> > >Bill Foley, Microsoft MVP (PowerPoint)
> > >Microsoft Office Specialist Master Instructor - XP
> > >www.pttinc.com
> > >Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
> > >Check out Word FAQs at:
> > http://word.mvps.org/FAQs/General/index.htm
> > >
> > >
> > >.
> > >
>
>



Re: VBA To Change Page Numbering in Header... by Lynn

Lynn
Tue Oct 19 04:30:17 CDT 2004

My Pleasure - glad you got it working
>-----Original Message-----
>FYI - I got it to work perfectly, however, I had to make
one minor change.
>I wasn't having luck automating the changing of Page 10
(field code) to Page
>10.1 (manually typing). Since this page number could
anywhere it also had
>to be determined via code, deleted, then entered
manually. OUCH! My head
>hurt just trying this.
>
>What I did was inserted the two Section Breaks, went
into the Headers,
>turned off the "Same As Previous", changed the page
number to "Start at...
>"CurPage - 1" (actually, CurPage =
>Selection.Information(wdActiveEndAdjustedPageNumber) -
1), then went to the
>previous header, selected the "Page" code, deleted it,
then brought up a
>message box telling the user to type in the desired page
number (10.1). The
>code I used was:
>
>Dim CurPage As Integer
>CurPage = Selection.Information
(wdActiveEndAdjustedPageNumber) - 1
> With Selection.HeaderFooter.PageNumbers
> .RestartNumberingAtSection = True
> .StartingNumber = CurPage
> End With
>
>
>Not perfect, but it worked! Thanks, Lynn for the
support!
>
>--
>Bill Foley, Microsoft MVP (PowerPoint)
>Microsoft Office Specialist Master Instructor - XP
>www.pttinc.com
>Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
>Check out Word FAQs at:
http://word.mvps.org/FAQs/General/index.htm
>
>"Bill Foley" <wfoley1@EATSPAMANDDIEtxu.com> wrote in
message
>news:OJt81YStEHA.2124@TK2MSFTNGP11.phx.gbl...
>> Thanks! At least this means that it is possible.
Now, if I could just
>> figure out how to do it! HA! I'll take a look at
this code and see if I
>> can figure out a way to code it to work. I know I
learn more by using the
>> "trial-and-error" method and since this seems doable,
I'm diving in!
>>
>> I'll holler back with my code sample if I start
drowning (which I'm sure I
>> will)! HA!
>>
>> --
>> Bill Foley, Microsoft MVP (PowerPoint)
>> Microsoft Office Specialist Master Instructor - XP
>> www.pttinc.com
>> Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
>> Check out Word FAQs at:
http://word.mvps.org/FAQs/General/index.htm
>>
>> "lynn taylor" <lynn.taylor@linklaters.com> wrote in
message
>> news:14b201c4b522$f28f7560$a301280a@phx.gbl...
>> > Hi Bill
>> > You can determine the current page number using vba
and
>> > then use that to update your next section start from
page
>> > number.
>> >
>> > Dim CurPage
>> > CurPage = Selection.Information
>> > (wdActiveEndAdjustedPageNumber)
>> >
>> > This will return the logical page number not a
physical
>> > page number. Logical page numbers take into account
>> > manual adjustments made to the document, like your
macro
>> > which deletes the page number field and replaces it
with
>> > text. Logicially the page is still page 11 but you
have
>> > typed in manual text 10.1. So the piece of code
above
>> > will return "11".
>> >
>> > When you go to your next section heading to change
the
>> > page number to start from, you put curPage instead
of a
>> > number. So something similar to
>> > Selection.HeaderFooter.PageNumbers.StartingNumber =
>> > CurPage
>> >
>> > Hope this helps
>> > Lynn
>> > >-----Original Message-----
>> > >Hey gang,
>> > >
>> > >Got sort of a unique one. I'll try to explain
without
>> > getting long-winded.
>> > >I have a procedure-type document with page
numbering in
>> > the Headers. Some
>> > >times we need to insert a change to the procedure
that
>> > forces a new page.
>> > >This new page needs to have a ".1" added to the
Header
>> > page numbering. For
>> > >example, if I need to add a new page (section
break -
>> > next page) between
>> > >pages 10 and 11, my page numbering will end up
being 10,
>> > 10.1, and 11.
>> > >
>> > >I have recorded a macro that has automated the
insertion
>> > of two section
>> > >breaks, turned off "Same as Previous", but I need
to do
>> > the following:
>> > >
>> > >1. On the new page, change the existing "field" page
>> > numbering from the
>> > >existing number (in this case 11) to a hard-
typed "10.1".
>> > >2. On the page that goes back to regular numbering,
>> > change it's new number
>> > >(12) back to 11.
>> > >
>> > >I know it is quite easy to select the first page
number
>> > and delete it by
>> > >typing the actual page number I want, and going to
the
>> > next section header
>> > >and selecting the page number and changing it
to "Start
>> > at...11", but I was
>> > >hoping I could automate this for my staff (who
aren't
>> > the most literate of
>> > >word-processors)! HA! Sine this new page added
could
>> > be anywhere, I am
>> > >hoping to be able to look at the existing page
number
>> > and change it to
>> > >"Start at..." one less that it shows now. Not sure
if
>> > this can be done.
>> > >Especially with my limited VBA knowledge!
>> > >
>> > >Any ideas would be greatly appreciated. If you
want me
>> > to post the recorded
>> > >code I have for the Section breaks, holler back.
>> > >
>> > >TIA!
>> > >
>> > >--
>> > >Bill Foley, Microsoft MVP (PowerPoint)
>> > >Microsoft Office Specialist Master Instructor - XP
>> > >www.pttinc.com
>> > >Check out PPT FAQs at:
http://www.rdpslides.com/pptfaq/
>> > >Check out Word FAQs at:
>> > http://word.mvps.org/FAQs/General/index.htm
>> > >
>> > >
>> > >.
>> > >
>>
>>
>
>
>.
>