×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Extract links from word (gray hyperlinks)

Extract links from word (gray hyperlinks)

Extract links from word (gray hyperlinks)

(OP)
I usually save to notepad or Access, but Tweets require Word to see gray hyperlinks, which must be separately selected between double quotes from within Hyperlink tag.
(Not a Programmer nor write code.)

Instead of extracting only links in wrong order to a new doc ..

Below code (I changed) extracts/inserts link before gray hyperlink, inplace within tweet, within current document. (Inserting after gray hyperlink makes extracted link gray also).

Question:
It's 99% there, but how to also extract date and time along with status url?

{HYPERLINK "https://twitter.com/accountname/status/792726" \o "7:27 AM - 26 Nov 2019" }
Tweet message.

Word macro code:

Sub HlinkChanger()
Dim oRange As Word.Range
Dim oField As Field
Dim link As Variant
With ActiveDocument
' .Range.AutoFormat '(orig) I commented out
For Each oRange In .StoryRanges
For Each oFld In oRange.Fields
If oFld.Type = wdFieldHyperlink Then
For Each link In oFld.Result.Hyperlinks
oFld.Select
Selection.InsertBefore (" (" + link.Address + ") ") '(orig) InsertAfter
'Selection.InsertBefore (" (" + link.Address & " " & link.SubAddress + ") ")
Next link
End If
Next oFld
Set oRange = oRange.NextStoryRange
Next oRange
End With
End Sub

RE: Extract links from word (gray hyperlinks)

One way:

CODE

Sub Demo()
Application.ScreenUpdating = False
Dim hLnk As Hyperlink
With ActiveDocument
  For Each hLnk In .Hyperlinks
  .Range.InsertBefore Trim(Replace(Split(hLnk.Range.Fields(1).Code.Text, "HYPERLINK")(1), Chr(34), "")) & vbCr
  Next
End With
Application.ScreenUpdating = True
End Sub 

Cheers
Paul Edstein
[MS MVP - Word]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close