Converting many many URL links in RTF file to active links

B

BA

Thank you very much for reading this.

I have a number of RTF files with bibliographic citations (exported from
RefMan), each citation has a properly formatted link to a URL, which is on a
line by itself preceded by a soft paragraph return.

When I open the RTF in Word, and enter a paragraph return after a URL, the
link becomes "active"….just as it should!

Here is the question…some of these RTF documents have 100's of citations,
each with a link that must be made active, so that I can inturn save the
pages as HTML for a web site project.
Is there anyway to search and replace (or some other method) to add a
paragraph return that makes these links active?

A basic search and replace/add paragraph does not do the trick!

Having to click on each URL is way too time consuming—over 3,200
bibliographic citations and URLs need to made active.

Here is an example…

Loyer, X., Heymes, C., and Samuel, J. L.(2008) Constitutive nitric oxide
synthases in the heart from hypertrophy to failure.
Clin.Exp.Pharmacol.Physiol: (35) 483-488.
http://www.ncbi.nlm.nih.gov/pubmed/18307746
 
J

Jay Freedman

BA said:
Thank you very much for reading this.

I have a number of RTF files with bibliographic citations (exported
from RefMan), each citation has a properly formatted link to a URL,
which is on a line by itself preceded by a soft paragraph return.

When I open the RTF in Word, and enter a paragraph return after a
URL, the link becomes "active"..just as it should!

Here is the question.some of these RTF documents have 100's of
citations, each with a link that must be made active, so that I can
inturn save the pages as HTML for a web site project.
Is there anyway to search and replace (or some other method) to add a
paragraph return that makes these links active?

A basic search and replace/add paragraph does not do the trick!

Having to click on each URL is way too time consuming-over 3,200
bibliographic citations and URLs need to made active.

Here is an example.

Loyer, X., Heymes, C., and Samuel, J. L.(2008) Constitutive nitric
oxide synthases in the heart from hypertrophy to failure.
Clin.Exp.Pharmacol.Physiol: (35) 483-488.
http://www.ncbi.nlm.nih.gov/pubmed/18307746

The conversion of text URLs to working hyperlinks is an AutoFormat function.
There are two separate ways to run AutoFormat. The one you're used to is
"AutoFormat As You Type", which is triggered when you type the space or
punctuation that signals the end of the URL -- but this doesn't work if you
aren't actually hitting keys (that's why search/replace doesn't do it).

The other is just plain "AutoFormat". In Word 2003 and earlier, this is
triggered by the command Format > AutoFormat; in Word 2007 you need to open
the Customize dialog and add the AutoFormat Now command to the Quick Access
Toolbar. This runs through the entire document and handles everything it
recognizes.

Before running this command, go to Tools > AutoCorrect Options > AutoFormat
(in Word 2007, go to Office button > Word Options > Proofing > AutoCorrect >
AutoFormat). Note that there are two tabs, AutoFormat As You Type and just
AutoFormat, and you want just AutoFormat. Uncheck everything except
"Internet and network paths with hyperlinks" to avoid applying all sorts of
formatting you don't want!

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
B

BA

Auto Format! Awsome feature...

Now here is a hard question...is there any way to auto format each link to
simply say "Link", but of course retain the underlying and correct URL
address? Again I know that I can go "Edit Hyperlink" and change the display
name to "Link", but doing thousands of time seems daunting...

Thank you
 
J

Jay Freedman

Ah, now you're digging a little deeper than AutoFormat can go. You need a
little macro (see http://www.gmayor.com/installing_macro.htm if needed):

Sub AllURLsSayLink()
Dim HL As Hyperlink
For Each HL In ActiveDocument.Hyperlinks
HL.TextToDisplay = "Link"
Next
End Sub

This will change only the displayed text, not the address or the tooltip
(which will show the address).
Auto Format! Awsome feature...

Now here is a hard question...is there any way to auto format each
link to simply say "Link", but of course retain the underlying and
correct URL address? Again I know that I can go "Edit Hyperlink" and
change the display name to "Link", but doing thousands of time seems
daunting...

Thank you


--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
B

BA

What happens if I happen to be on a Word 2008 Mac?

Just do this on a Windows machine Windows, or is there a way?
 
J

Jay Freedman

Ahh, the infamous "we don't need no steenkin' VBA" debacle. I think you'll
have to ask this question in one of the Mac Word newsgroups, because I don't
know what your alternatives are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top