|
|
|
date: Sat, 15 Mar 2008 20:02:59 -0700 (PDT),
group: microsoft.public.word.word6-7macros
back
Re: Valid inputs to methods in Word object model?
I cannot point you to a "complete interface specification"; I am not even
sure that one exists, or that if it did, it would cover the circumstance
that you relate. The online help file just provides in that case:
Returns a Footnotes collection that represents all the footnotes in a range.
Read-only.
expression.Footnotes
expression A variable that represents a Range object.
Then if you dig down to the Range object you find only:
Range Object
Represents a contiguous area in a document. Each Range object is defined by
a starting and ending character position.
Remarks
Similar to the way bookmarks are used in a document, Range objects are used
in Visual Basic procedures to identify specific portions of a document.
However, unlike a bookmark, a Range object only exists while the procedure
that defined it is running.Range objects are independent of the selection.
That is, you can define and manipulate a range without changing the
selection. You can also define multiple ranges in a document, while there
can be only one selection per pane.
Use the Range method to return a Range object defined by the given starting
and ending character positions. The following example returns a Range object
that refers to the first 10 characters in the active document.
Visual Basic for Applications
Set myRange = ActiveDocument.Range(Start:=0, End:=10)
Use the Range property to return a Range object defined by the beginning and
end of another object. The Range property applies to many objects (for
example, Paragraph, Bookmark, and Cell). The following example returns a
Range object that refers to the first paragraph in the active document.
What I can do though is point out that the newsgroup to which you posted
your question is not the most appropriate and it may therefore not be seen
by people who know more about the subject than I do. The reason that I say
that is that this group was for questions concerning the use of macros in
Word Versions 6 and 7, where Word.Basic was the programming language, rather
than Visual Basic for Applications. Given that those versions of Word were
superseded about 11 years ago now, this group gets very little traffic.
A better group to post to would be microsoft.public.word.vba.general
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Mike" wrote in message
news:15a7a086-6304-4c7d-b4a5-bdda7d882d88@8g2000hsu.googlegroups.com...
> We have been surprised several times by errors from methods in the
> Word object model in Word 2003 and Word 2007. Most recently, we had a
> For loop from 1 to Selection.Footnotes.Count. We got an error when a
> user activated that code from a header because headers cannot contain
> Footnotes and so Selection.Footnotes.Count generated an error. (Had
> we thought of that case, which we did not, we would have assumed that
> the count would come back as zero. Live and learn.)
>
> It's easy enough to dream up an ex post explanation for why a Range
> that includes text in a header is not a valid input to the Count
> method. However, we'd like to find a complete interface spec for the
> methods in the Word object model so that we can made predictions
> instead of excuses. We would be most appreciative to anyone who can
> direct us to such information.
>
> Thank you in advance for any help that you can give.
>
> - Mike
date: Sun, 16 Mar 2008 17:03:40 +1000
author: Doug Robbins - Word MVP
|
|