Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 07-31-2018, 12:41 AM
henrychang henrychang is offline Convert plaintext to hyperlink in footnote section Windows 10 Convert plaintext to hyperlink in footnote section Office 2016
Novice
Convert plaintext to hyperlink in footnote section
 
Join Date: Jul 2018
Posts: 5
henrychang is on a distinguished road
Default

I tried to use your code , but it seemed unable to trim the unwanted punctuations.
For example,
Code:
Roa, Felipe Suescun de, Comments on the ICSID Award Saipem v. Bangladesh: Would its rationale be applicable in future cases?, INT'L INST. FOR CONFLICT PREVENTION & RESOL. (May 5, 2011), http://www.cpradr.org/news-publications/articles/2011-05-05-comments-on-the-icsid-award-saipem-v-bangladesh-would-its-rationale-be-applicable-in-future-cases-2011-writing-contest-winner.
This url-text cannot be recognized correctly, still includes the last period.

Code:
Sub ConvertURLTextsToHyperlinksInDoc()
Dim wdRng As Range
For Each wdRng In ActiveDocument.StoryRanges
  With wdRng
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "htt[ps]{1,2}://[!^13^t^l ]{1,}"
      .Replacement.Text = ""
      .Forward = True
      .Format = False
      .Wrap = wdFindStop
      .MatchWildcards = True
      .Execute
    End With
    Do While .Find.Found
      If .Characters.Last Like "[!:;.,?})]" Then .End = .End - 1
      .Hyperlinks.Add .Duplicate, .Text, , , .Text
      .Start = .Hyperlinks(1).Range.End
      .Find.Execute
    Loop
  End With
Next
End Sub
Reply With Quote
 

Tags
footnote, hyperlink



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert plaintext to hyperlink in footnote section Convert endnote/footnote to regular text Cobb78 Word 5 07-11-2016 06:23 AM
Convert plaintext to hyperlink in footnote section Footnote numbering problem within single section jsswadley Word 2 03-17-2015 04:44 PM
Convert plaintext to hyperlink in footnote section Convert Word Document including FOOTNOTE into Outlook Message withers Word 1 08-21-2014 05:03 AM
Convert plaintext to hyperlink in footnote section How to have "Footnote" in section different from the section for the words it refers Jamal NUMAN Word 2 07-03-2011 03:06 AM
Microsoft word hyperlink to section in a pdf Ian55555 Word 0 09-29-2009 09:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:23 PM.


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