View Single Post
 
Old 02-16-2018, 11:27 AM
poetofpiano poetofpiano is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2015
Posts: 25
poetofpiano is on a distinguished road
Default

Thank you for your help macropod. Because your version only copied the name of the bookmark instead of the full file path, I used a simplified version of your suggestion as follows:

Code:
Sub CopyHyperlink()
Dim Rng As Range
Set Rng = Selection.Hyperlinks(1).Range.Fields(1).Code
Rng.Copy
End Sub
This copied the following to the clipboard:

Code:
HYPERLINK "file:///C:\\Users\\Username\\Dropbox\\Doc.docx" \l "Bookmark Name"
Then using string and regex functions in Autohotkey, I was able to pare down the clipboard to just the following:

Code:
C:\Users\Username\Dropbox\Doc.docx#Bookmark Name
This is exactly what I was looking for, so thank you so much!
Reply With Quote