Access 2000 VBA Loop through Hyperlinks in a Word 2000 Document

T

Tony_VBACoder

I am trying to write a simple VBA function in Access 2000 that will open a
Word 2000 document that has Hyperlinks, and store each Hyperlink in an Array.

Can anyone provide some sample code?

Thank You
 
R

Ralph

Gave up on searching through pdf files...?

Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdPath As String
Dim wdHL As Word.Hyperlink
Dim strLinks() As String
Dim i As Integer

ReDim strLinks(i)
wdPath = CurrentProject.Path & "\"

Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Open(wdPath & "YourDocNameHere.doc")

For Each wdHL In wdDoc.Hyperlinks
strLinks(i) = wdHL.Address
i = i + 1
ReDim Preserve strLinks(i)
Next

wdDoc.Close
wdApp.Quit
Set wdDoc = Nothing
Set wdApp = Nothing

ReDim Preserve strLinks(i - 1)

For i = 0 To UBound(strLinks)
Debug.Print strLinks(i)
Next
 

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