View Single Post
 
Old 02-17-2018, 03:01 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

OK. I see your point, but the issues you raise are not insurmountable - how about
Code:
Sub GetLinkAddress2()
Dim hLink As Hyperlink
Dim oRng As Range
    Set oRng = ActiveDocument.Range
    oRng.Collapse 0
    Set hLink = Selection.Hyperlinks(1)
    oRng.Text = hLink.Address
    If Not hLink.SubAddress = "" Then oRng.Text = oRng.Text & "#" & hLink.SubAddress
    MsgBox oRng.Text & vbCr & "copied to clipboard"
    oRng.Cut
lbl_Exit:
    Set hLink = Nothing
    Set oRng = Nothing
    Exit Sub
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