Thread: [Solved] Copy from a huge document
View Single Post
 
Old 09-10-2014, 10:03 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
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

To run it from the hyperlink. Put the cursor in the hyperlink and run the following modified version. This will copy the section to the clipboard and return to the start position

Code:
Sub SelectAndCopySection()
Dim oRng As Range
Dim oStart As Range
Dim lngSect As Long
    Set oStart = Selection.Range
    If oStart.Hyperlinks.Count = 1 Then
        oStart.Hyperlinks(1).Follow
        lngSect = Selection.Information(wdActiveEndSectionNumber) + 1
        Set oRng = ActiveDocument.Sections(lngSect).Range
        oRng.End = oRng.End - 1
        oRng.Copy
        oStart.Select
    End If
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