![]() |
|
#5
|
||||
|
||||
|
You don't even need to identify the section number e.g.
Code:
Sub CopyCurrentSectionToNewDoc()
Dim rng As Range
Dim NewDoc As Document
Set rng = Selection.Sections(1).Range
rng.End = rng.End - 1
Set NewDoc = Documents.Add(Template:=ActiveDocument.AttachedTemplate.FullName, Visible:=True)
NewDoc.Range.FormattedText = rng.FormattedText
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Prevent header from using StyleRef x when x is not present in current section
|
Firebody | Word | 8 | 11-12-2021 10:53 AM |
| Require VBA to copy value into current field of Internet Explorer | trevorc | Excel Programming | 0 | 01-15-2019 03:17 PM |
| If Cell Blank Copy Data from Above Combine All to Current | ChrisOK | Excel Programming | 2 | 12-18-2017 11:25 PM |
Show current section in status bar
|
Phil H | Word | 2 | 02-02-2016 01:45 PM |
| a macro that can copy data from copy.xls to our current excel macro.xls based on criteria: | udhaya | Excel Programming | 1 | 11-12-2015 10:12 AM |