Using VB.NET how do you capture the text on the first page of a Microsoft Word document? I've imported the Word 12 interop library (for Word 2007), and I know how to use the document.range function, but how do you know which page you're on when you're selecting text?
+1
A:
Roughly speaking, you don't. Word doesn't have a solid concept of pages... See http://daiya.mvps.org/wordpages.htm for example.
You could try something like:
docMyDocument.Bookmarks("\Page").Range
Which mostly works, but isn't guaranteed to. (It fails if there are tables stradding the end of the page, for example...)
Stobor
2009-02-18 23:30:25