![]() |
|
|
|
#1
|
|||
|
|||
|
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
|
|
#2
|
||||
|
||||
|
By doing in code the same as you'd do manually via Insert|Cross-Reference>Heading.
If you can identify the heading to bookmark it, so that you can cross-reference the bookmark, you can just as easily identify it for cross-referencing without the bookmark. Quote:
.Range.InsertFile ... Insert: Code:
For Each HdFt In Scn.Footers
.Range.Text = vbNullString
HdFt.LinkToPrevious = True
Next
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inserting one document into another | Bluie | Word | 5 | 05-17-2012 12:00 PM |
Inserting a "Book Section" in the Bibliography of word 2007
|
tanababa | Word | 3 | 09-25-2011 03:41 AM |
| Margins in multiple section document | oaty | Word | 0 | 08-15-2010 07:32 AM |
| Linking within the same document | tam5070 | Word | 0 | 02-06-2009 02:21 PM |
| Same As Previous - changing default when inserting/pasting | LdeMarais | Word | 0 | 09-21-2007 11:07 AM |