Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 03-12-2024, 11:07 PM
gmayor's Avatar
gmayor gmayor is offline Copy Current Section to a New Document Windows 10 Copy Current Section to a New Document Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Current Section to a New Document 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
Copy Current Section to a New Document 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft