I need to create a macros that will insert different headers and footers into
a particular document. So far, I've created a successful macro that copies
the header and footer on page 1 of a template and pastes it into page 1 of an
existing document. Now for the dilemma, page 2 needs to have a different
header and footer. I already have the page 1 header and footer set to be
different from all other pages. The problem is, how do I get a macro to
access the page 2 header on my template and copy that into page 2 of the
existing document. I tried to record a macro doing this, but it doesn't
insert anything into my existing document. I think it needs a page break
inserted or something. Is there a way to insert a page break at the end of a
page, regardless of what text is on it? Is this possible? Please help!!!
Natalie - 13 Jun 2007 19:34 GMT
Is there a way to have a macro go to the end of text on page 1 and insert a
page break?
> I need to create a macros that will insert different headers and footers into
> a particular document. So far, I've created a successful macro that copies
[quoted text clipped - 7 lines]
> inserted or something. Is there a way to insert a page break at the end of a
> page, regardless of what text is on it? Is this possible? Please help!!!
alborg - 14 Jun 2007 06:02 GMT
Hi Natalie:
For your second question, try-
Dim xEnd As Integer, i As Integer
ActiveDocument.Select
i = 1
For i = 1 To 45
Selection.TypeParagraph
Next i
Selection.InsertBreak Type:=wdPageBreak
Cheers,
Al
> Is there a way to have a macro go to the end of text on page 1 and insert a
> page break?
[quoted text clipped - 10 lines]
> > inserted or something. Is there a way to insert a page break at the end of a
> > page, regardless of what text is on it? Is this possible? Please help!!!
alborg - 14 Jun 2007 06:19 GMT
Hi Natalie:
Try this-
With ActiveDocument
.PageSetup.DifferentFirstPageHeaderFooter = True
.Sections(1).Footers(wdHeaderFooterFirstPage).Range.InsertBefore
"Written by Kate Edson"
End With
Dim xEnd As Integer, i As Integer
ActiveDocument.Select
i = 1
For i = 1 To 45
Selection.TypeParagraph
Next i
Selection.InsertBreak Type:=wdPageBreak
With ActiveDocument
.PageSetup.DifferentFirstPageHeaderFooter = True
.Sections(1).Footers(wdHeaderFooterPrimary).Range.InsertAfter "This is
the second page"
End With
Cheers,
Al
> I need to create a macros that will insert different headers and footers into
> a particular document. So far, I've created a successful macro that copies
[quoted text clipped - 7 lines]
> inserted or something. Is there a way to insert a page break at the end of a
> page, regardless of what text is on it? Is this possible? Please help!!!
Russ - 15 Jun 2007 19:51 GMT
Inline reply
> I need to create a macros that will insert different headers and footers into
> a particular document. So far, I've created a successful macro that copies
> the header and footer on page 1 of a template and pastes it into page 1 of an
> existing document.
The concept of templates is that you set it up to have whatever you want
repeated in your documents and either add it as a global template (which
would affect all documents) or attach it to a newly added document (which
limits the template's scope to that document).
No copy and paste needed.
Create the template with the header or footers you require and then have it
attached to the document when you add it.
> Now for the dilemma, page 2 needs to have a different
> header and footer. I already have the page 1 header and footer set to be
> different from all other pages. The problem is, how do I get a macro to
> access the page 2 header on my template and copy that into page 2 of the
> existing document. I tried to record a macro doing this, but it doesn't
> insert anything into my existing document.
> I think it needs a page break
> inserted or something. Is there a way to insert a page break at the end of a
> page, regardless of what text is on it? Is this possible? Please help!!!
Having two consecutive page breaks in a row will generate a blank page. Is
that what you wanted?

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID