Print associated document hyperlinks

W

Worsty

I have a word document that has hyperlinks in it. When I print it I
would like it to also print all associated hyperlink documents. Is
this possible using VBA?
 
G

Graham Mayor

Assuming the hyperlinks you want to print are hyperlinks to other word
documents (*.doc) then

Sub PrintDocAndHyperlinkedDocs()
Dim iFld As Integer
Dim sHlink As String
Dim oLinkDoc As Document
'ActiveDocument.PrintOut
For iFld = 1 To ActiveDocument.Fields.Count
With ActiveDocument.Fields(iFld)
sHlink = .Code.Text
If InStr(1, sHlink, "doc""") Then
sHlink = Replace(sHlink, "HYPERLINK ", _
"")
Set oLinkDoc = Documents.Open(sHlink)
oLinkDoc.PrintOut
oLinkDoc.Close wdDoNotSaveChanges
End If
End With
Next iFld
End Sub

should do the trick http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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