Reply
 
Thread Tools Display Modes
  #1   Report Post  
trapdoor trapdoor is offline
Junior Member
 
Posts: 0
Default Making Many URLs into Hyperlinks Using Macro

Hi,
I'm trying to convert many urls in this format to hyperlinks:
http://www.example.com

So after conversion they would like that with the URL as the anchor text, nothing fancy.

I have a macro that does this, but deletes the carriage returns before and after the URL. Please the attached pictures before and after the macro has been run. How would I go about fixing the attached code to stop doing this?
Thanks!

Code:
Sub URL2Hyperlink()
  Dim f1 As Boolean, f2 As Boolean, f3 As Boolean
  Dim f4 As Boolean, f5 As Boolean, f6 As Boolean
  Dim f7 As Boolean, f8 As Boolean, f9 As Boolean
  Dim f10 As Boolean
  With Options
    ' Save current AutoFormat settings
    f1 = .AutoFormatApplyHeadings
    f2 = .AutoFormatApplyLists
    f3 = .AutoFormatApplyBulletedLists
    f4 = .AutoFormatApplyOtherParas
    f5 = .AutoFormatReplaceQuotes
    f6 = .AutoFormatReplaceSymbols
    f7 = .AutoFormatReplaceOrdinals
    f8 = .AutoFormatReplaceFractions
    f9 = .AutoFormatReplacePlainTextEmphasis
    f10 = .AutoFormatReplaceHyperlinks
    ' Only convert URLs
    .AutoFormatApplyHeadings = False
    .AutoFormatApplyLists = False
    .AutoFormatApplyBulletedLists = False
    .AutoFormatApplyOtherParas = False
    .AutoFormatReplaceQuotes = False
    .AutoFormatReplaceSymbols = False
    .AutoFormatReplaceOrdinals = False
    .AutoFormatReplaceFractions = False
    .AutoFormatReplacePlainTextEmphasis = False
    .AutoFormatReplaceHyperlinks = True
    ' Perform AutoFormat
    ActiveDocument.Content.AutoFormat
    ' Restore original AutoFormat settings
    .AutoFormatApplyHeadings = f1
    .AutoFormatApplyLists = f2
    .AutoFormatApplyBulletedLists = f3
    .AutoFormatApplyOtherParas = f4
    .AutoFormatReplaceQuotes = f5
    .AutoFormatReplaceSymbols = f6
    .AutoFormatReplaceOrdinals = f7
    .AutoFormatReplaceFractions = f8
    .AutoFormatReplacePlainTextEmphasis = f9
    .AutoFormatReplaceHyperlinks = f10
  End With
End Sub
Attached Images
  
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I display the urls to hyperlinks in printed documents only? Kathy[_3_] Microsoft Word Help 2 December 7th 08 09:04 PM
All hyperlinks displaying full URLs Paul R Microsoft Word Help 3 February 6th 07 10:28 AM
Turning hyperlinks BACK to full path URLs kjf Microsoft Word Help 2 January 18th 07 10:07 PM
URLS for hyperlinks instead of display text? cyndiwise notsowise Microsoft Word Help 4 February 27th 06 05:15 AM
Making TOC Hyperlinks Joseph McGuire Microsoft Word Help 7 April 21st 05 06:06 AM


All times are GMT +1. The time now is 09:06 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"