View Single Post
 
Old 09-04-2012, 07:03 PM
ubns ubns is offline Windows 7 32bit Office 2010 32bit
Competent Performer
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

Thanks. How can we reference a heading without a bookmark?

With regards to the the code I am talking about (for the page break) see the code below (which was provided by you). I was wondering if we can delete the existing footer of newly inserted document and link it to the previous footer?

Code:
Sub insertdoc_essential()
Dim Scn As Section, HdFt As HeaderFooter
With ActiveDocument
  Set Scn = .Sections.Add(Range:=.Range.Characters.Last, Start:=wdSectionNewPage)
  With Scn
      For Each HdFt In Scn.Headers
      HdFt.LinkToPrevious = False
      .Range.Text = vbNullString
    Next
    For Each HdFt In Scn.Footers
      HdFt.LinkToPrevious = False
      .Range.Text = vbNullString
    Next
    .Range.InsertFile FileName:="p:\psk service agreements\client ongoing service agreement - Essentials.docx"
    While .Range.Characters.Last.Previous = vbCr
      .Range.Characters.Last.Previous.Delete
    Wend
  End With
End With
End Sub
Reply With Quote