A
avkokin
Hello.
There is the document which has many hyperlinks. I need to extract (to
copy) all these hyperlinks to new document. I use next code for this
(below). It works. Question: is this code correct or it can be turn
for the better?
Thank you very much.
The code:
Sub extractHyperlinks()
Dim oHpl As Hyperlink
Dim dAD As Document 'active document
Dim dDc As Document 'new document
Set dAD = ActiveDocument
Set dDc = Documents.Add(Visible:=False)
For Each oHpl In dAD.Hyperlinks
oHpl.Range.Copy
dDc.Activate
Selection.Paste
Selection.TypeParagraph
Next
dDc2.SaveAs "C:\Test\" & Format("hl") & ".doc"
dDc2.Close
Set dAD = Nothing
Set dDc = Nothing
End Sub
There is the document which has many hyperlinks. I need to extract (to
copy) all these hyperlinks to new document. I use next code for this
(below). It works. Question: is this code correct or it can be turn
for the better?
Thank you very much.
The code:
Sub extractHyperlinks()
Dim oHpl As Hyperlink
Dim dAD As Document 'active document
Dim dDc As Document 'new document
Set dAD = ActiveDocument
Set dDc = Documents.Add(Visible:=False)
For Each oHpl In dAD.Hyperlinks
oHpl.Range.Copy
dDc.Activate
Selection.Paste
Selection.TypeParagraph
Next
dDc2.SaveAs "C:\Test\" & Format("hl") & ".doc"
dDc2.Close
Set dAD = Nothing
Set dDc = Nothing
End Sub