A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Making Many URLs into Hyperlinks Using Macro



 
 
Thread Tools Display Modes
  #1  
Old June 12th 09, 01:09 AM
trapdoor trapdoor is offline
Junior Member
 
First recorded activity by WordBanter: May 2009
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
  
Ads
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
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 10:04 PM
All hyperlinks displaying full URLs Paul R Microsoft Word Help 3 February 6th 07 11:28 AM
Turning hyperlinks BACK to full path URLs kjf Microsoft Word Help 2 January 18th 07 11:07 PM
URLS for hyperlinks instead of display text? cyndiwise notsowise Microsoft Word Help 4 February 27th 06 06: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 02:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2004-2021 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.