WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Word

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2002:09:05:13:50:54
Last Updated: 2002:09:05:13:50:54