View Single Post
 
Old 08-23-2012, 05:58 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 Inserting Document and linking with previous section

Sometime ago Paul assisted me with the code of inserting another document in a document (At the end).

The code is in this post.

Is it possible that when this document is inserted - it also do the following:

1) Remove the existing footer and replace it by linking it with previous section footer.
2) Add a specific bookmark to the heading of inserted document.

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
Regards

Umesh Banga

Last edited by ubns; 08-24-2012 at 03:20 AM. Reason: na
Reply With Quote