Hyperlink

R

rachelh

hello,
How can I move the cursor after a specific hyperlink using VBA?
I am finding the hyperlinks as follows:
For Each aHyperlink In ActiveDocument.Hyperlinks

Thanks
 
H

Helmut Weber

Hi Rachel,
like this, e.g.:
Sub Test351()
Dim rDcm As Range
Dim oHpr As Hyperlink
Set rDcm = ActiveDocument.Range
For Each oHpr In rDcm.Hyperlinks
If oHpr.Address = "another.doc" Then
oHpr.Range.Select
Selection.Collapse Direction:=wdCollapseEnd
Exit For
End If
Next
End Sub
 
H

Helmut Weber

<gr>
better this way:
ActiveDocument.Hyperlinks("chart.doc").Range.Select
plus collapse as in the former posting
 

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