![]() |
#6
|
||||
|
||||
![]()
With the code in the link, and assuming you're using early binding, you'd replace:
Code:
Dim Sctn1 As Section, Sctn2 As Section Code:
Dim wdApp as New Word.Application, wdDoc as Word.Document Dim Sctn1 As Word.Section, Sctn2 As Word.Section Code:
With Selection If .Sections.Count = 1 Then MsgBox "Selection does not span a Section break", vbExclamation Exit Sub End If Code:
Set wdDoc = wdApp.Documents.Add (template reference) With wdDoc Code:
Set Sctn1 = .Sections.First: Set Sctn2 = .Sections.Last Code:
Set Sctn1 = .Sections(x): Set Sctn2 = .Sections(y) You'd also need to replace the loop: Code:
While .Sections.Count > 1 .Sections.First.Range.Characters.Last.Delete Wend Code:
.Range(.Sections(x).Range.Start, .Sections(y).Range.Start - 1).Delete
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
HelpNeed | Word VBA | 2 | 06-27-2017 06:15 PM |
different header/footer sections/ page numbers | Angela H | Word | 4 | 07-01-2015 12:45 PM |
![]() |
bgranzow | Mail Merge | 9 | 06-05-2015 05:03 AM |
![]() |
Albus | Word | 12 | 12-12-2014 01:36 PM |
Different Header Same Footer across two sections - Letterhead | bostockm | Word | 1 | 07-21-2014 05:36 AM |