Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Find the Links in a Word Doc

 Keywords: OLE Word Hyper links Hyperlinks

Question:

Is there a way to have Winbatch, tell Word thru OLE, to break hyperlinks in a document. I have not been able to figure this one out.

Answer:

I was able to find the links in a preset document and delete them, but breaking them is a bit of puzzle.
;	create word object...
wordapp = objectopen("Word.Application")
;	set the documents object...
docs = wordapp.documents
;	open a preset file...
docs.open("C:\data\word\http.doc")
;	make word visible...
wordapp.visible = @true
;	set the activedocument object...
thisdoc = wordapp.activedocument
;	set the hyperlinks collection object...
hlinks = thisdoc.hyperlinks
;	show a message with the document name and how many links in the document...
message(thisdoc.name, strcat("There are ", hlinks.count, " Links in this document."))
;	loop thru the links
for x = 1 to hlinks.count
;	setup an individual link object...
	thislink = hlinks.item(x)
	;	show the link's name...
	message("Debug", thislink.name)
;	delete the link
	thislink.delete
next
exit
The actual "breaklink" action is part of the linkformat, but how to associate a link with its format is unclear.
Article ID:   W15267