Hi Gordon,
Can anyone tell me the difference between ActiveDocument.Content and
ActiveDocument.Range? From reading the VBA help it appears that if you don't
specify a Start or End for ActiveDocument.Range it works the same as
ActiveDocument.Content.
Or have I missed something...?
Content is a property of the Document object that returns a Range that equals
the entire MainDocument story (no headers, footers, etc.) This property is
available only for the Document object. It's like using myTable.Range or
myBookmark.Range.
Document.Range is actually a method that returns a Range object. IMO it was a
mistake to create an object, a property and a method with the same name.
Probably this is how we ended up with Content for the document range - at a
later point someone realized the Developer is going to need that Range object
on a regular basis and would have no straight-forward way to access it. If that
had been clear earlier, the method would probably be named something like
GetRange.
In VBA the result of the Document.Range is the same as Document.Content because
the default of the optional parameters returns the start and end points of the
MainDocument story. In other programming languages (such as C#) these
parameters are not optional and there is no default value provided, so the
result and usage of Content and Range are not the same. For this reason, I
always try to use Content when I mean "the entire main document story".
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail