Original content

Protected by Copyscape Plagiarism Checker

Saturday, April 24, 2010

VBS Extract MS word document links to separate file

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set f = objFSO.OpenTextFile("c:\hyperlinks.txt", 2 , True) 'file name’s to which links to be written
Set objDoc = objWord.Documents.Open("c:\Exercises.doc") 'Word document from which links have to be separated
Set colHyperlinks = objDoc.Hyperlinks
For Each objHyperlink in colHyperlinks
f.WriteLine(objHyperlink.Address)
Next

No comments:

Post a Comment