Using VBA to navigate within a document with existing hyperlinks

S

Sardonic

I am using Word 2003. Part of the what I am trying to do requires me to move
from hyperlink to hyperlink within the one document. (To copy sections to be
pasted in other documents).

Is there a VBA Code for me to move to an existing hyperlink within the
current documents?

(eg Active Document.NavigateTo.Hyperlink.Ref\211637172)

Many thanks

Greg Williams
 
T

Tony Jollans

Use a loop to walk the Collection of Hyprlinks:

For Each H in ActiveDocument.Hyperlinks
' Do whatever with hyperlink H
Next
 
S

Sardonic

I'm sorry, my OP wasn't specific enough. I don't want to do anything to the
actual hyperlinks themselves.

I want to navigate to a collection of existing hyperlinks;
then copy text between each hyperlink;
depending on the name/label of the hyperlink open up one document;
paste the text into the new document;
close the new document;
carry onto next hyperlinks and rinse-repeat.

Apologies for any confusion caused.
 
T

Tony Jollans

When you have the hyperlink ('H' in the code I posted), you can access all
details of it. H.Range is like any other Word Range, or you can access
directly: H.Address, H.TextToDisplay, etc. I don't believe there's anything
you can't do inside the skeletal loop I posted.
 
S

Sardonic

This clears up the question in my mind! thanks again for your help. Much
appreciated.
 
G

Greg Zombek

I'm trying to modify this to be able to go through a document with multiple hyperlinks and print all the file to a PDF printer. Is this possible?
 

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