Print associated document hyperlinks

  • Thread starter Thread starter Worsty
  • Start date Start date
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?
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top