ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Open or launch hyperlinks from a pdf file

<< < (2/2)

I think he wants to open all of them at once rather than clicking on each.

I continue investigating.
Recently I got this :
1. Convert the pdf to a doc word document
2. Apply a function to extract all the url to a new doc file. a VB script for word 2010.
but for my God now I have lost the script. When refound I'll put here.
The answer is possible too with special software like pCOS and other (PDFlink ?).
I am trying to relocate all this and put the links....

Note : At my present situation my problem may be solved because now i have the url addresses in a txt file. And with "my" script LinetoClip I parse the url to the browser opening all the tabs even with a temporal distance between the launchs.
With the url in a txt file is super easy with AHK to multi launch.....

Really my target now is the partial scanning of any folder to my goldmine database.
While scanning the folder the files are added to my database and linked in the link tab. I can do in two ways : creating multiple records or a single records with all the links.
But the partial scanning must control the files and take into consideration past actions. This is useful with the scanned files folder of the year I need to link several times each year, but only once each file inside.


I have a text document with randomly spread URLs. Is there any solution to extract all the URLs under Word?

    Press Alt + F9 to display the fields
    Ctrl + F to open the search box
    Search: ^d hyperlink
    Check "Highlight all items found ..."
    Click on the Find All button
    Close the dialog
    Ctrl + C to copy everything that is highlighted
    Open a new document and paste.

Thanks to [email protected] for this tip.

This may be another method i haven't try. I am keep trying to locate the script for VB editor I used. .....


Retrieving Hyperlinks from a Word Document

One of the…joys…of working at a place like Microsoft is that you get plenty of opportunities to brush up on your reading; hardly a day goes by without you being asked to read a white paper, a spec, a proposal, a draft chapter…. As you might expect, any time you read that many things you’re bound to encounter a clunker or two; in fact, there have been several occasions when we said to ourselves, “Well, the paper isn’t very good, but there sure are a lot of useful references scattered throughout it. If only there was a way to extract the hyperlinks and discard the rest of the document.”

But, unfortunately, there’s no way to – what’s that? You say that the Microsoft Word object model includes something called the Hyperlinks collection, a collection that contains all the hyperlinks found in the document? You say that we could write a script that extracts all these hyperlinks? You say that we could then take these hyperlinks and add them to our Internet Explorer Favorites or save them as an HTML page?

Wow. Wish we’d thought of that.

Turns out that you guys were right: we can write a script that extracts all the hyperlinks from a Word document. In fact, here’s a script that does that very thing:

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("c:\scripts\test.doc")

Set colHyperlinks = objDoc.Hyperlinks

For Each objHyperlink in colHyperlinks
    Wscript.Echo objHyperlink.Address
    Wscript.Echo objHyperlink.TextToDisplay

That’s right: on top of being very handy this script is amazingly simple as well. We begin by creating an instance of the Word.Application object, and then set the Visible property to True. (We do that just so you’ll see Word pop up on the screen and thus get some assurance that the script is hard at work.) When then use the Open method to open the document C:\Scripts\Test.doc.

The rest is easy. We use the Hyperlinks property to return a collection of all the hyperlinks found in the document; those hyperlinks get stashed in a variable named colHyperlinks. Next we set up a For Each loop and loop through all the hyperlinks in the collection; for each hyperlink we echo the value of two properties:

    Address, which is the URL of the hyperlink.

    TextToDisplay, which is the text you actually click on.

For example, suppose we had a link like this, a link that takes you to the Script Center home page (

Script Center

If this is the only hyperlink in Test.doc then our script returns output like this:
Script Center

Yes, very cool.

But you’re right: not as cool as it could be. It’s nice that we can echo back URLs in a command window or a message box; unfortunately, though, you can’t click a hyperlink in a command window and be transported to that Web page. (We tried.) What would really be cool would be the ability to add these URLs to our Internet Favorites folder or to an HTML document. And because the Scripting Guys and cool are practically synonymous (hey, we said practically), then let’s do something really cool and add these URLs to our Internet Favorites:

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("c:\scripts\test.doc")

Set colHyperlinks = objDoc.Hyperlinks

For Each objHyperlink in colHyperlinks

Hey, we said this was cool; we didn’t say it was hard. As you can see we pretty much used the same script as before; the only difference is that we didn’t echo back the properties of each hyperlink. Instead we simply called the AddToFavorites method and had Word add each hyperlink to our Internet Favorites. (Really: try it for yourself and see.) Notice that we don’t even have to pass the AddToFavorites method any parameters; it does all the work for us.

Of course, this also means that AddToFavorites won’t always do things exactly the way we’d like them to. For example, when testing this method we had the following hyperlink (linking to in our document:

Hey, Scripting Guy!

When this was added to our Internet Favorites it looked like this:

Default.mspx (

The link worked fine; it just had a different name than we expected.

Of course, you might not want every hyperlink automatically added to your Internet Favorites. But that’s OK; it’s very easy to create an HTML page that includes all these links. All you’d have to do then is open that particular page and start clicking links. For example, here’s a script that creates a file named C:\Scripts\Links.htm. The script then grabs all the hyperlinks from our Word document and uses HTML tagging to create a corresponding link in Links.htm:

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("c:\scripts\test.doc")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("c:\scripts\links.htm")

Set colHyperlinks = objDoc.Hyperlinks
For Each objHyperlink in colHyperlinks
    objFile.WriteLine "<a href=" & chr(34) & objHyperlink.Address & Chr(34) & ">" & _
        objHyperlink.TextToDisplay & "</a href><br>"


We won’t talk about the HTML tagging today; that’s a bit outside the scope of this column. However, you can find more information in the HTML and DHTML Reference on MSDN. In the meantime, here’s what your finished product might look like:
Internet Explorer

Now that’s cool.
Top of page

this may be another answer i haven't tried. I keep tryng to locate the script i applied


Owwww , this was the function :

--- ---Function doHL() Dim nd As Document Dim a As Document Dim h As Hyperlink Dim r As Range Application.ScreenUpdating = False Set a = ActiveDocument Set nd = Documents.Add For Each h In a.Hyperlinks Set r = nd.Range r.Collapse r.InsertParagraph r.InsertAfter (h.Address) Next nd.Activate Application.ScreenUpdating = True Application.ScreenRefresh End Function


[0] Message Index

[*] Previous page

Go to full version