R
Robin Tucker
Given a field code (called theField) I have obtained from the Fields
collection of my document, why is it that I am unable to set "insertion
point" for an item for the given document to be the end of the field code?
My code looks something like this:
m_WordDocument.Range.SetRange(theField.Result.Start, theField.Result.End)
m_WordDocument.Range.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
m_WordDocument.Range.Move(Word.WdUnits.wdCharacter, 1)
theField.Result.Start = 120 and theField.Result.End = 149. Before calling
"SetRange", the document range is 0..480. Strangely, after calling
"SetRange", the document range has not changed, even though I've passed in
120 and 149! It seems that "Range" stores the extent of the document, from
0...n. I want to be able to insert things at specific positions within the
document.
Previously I was doing this using Application.Selection.Range etc. However,
it quickly became apparent that Application.Selection refers to the
currently active document, which would knobble my application as soon as the
user opened another instance of word.
How can I manipulate the insertion point for the current document?
Thanks for any help you can give me.
Robin
collection of my document, why is it that I am unable to set "insertion
point" for an item for the given document to be the end of the field code?
My code looks something like this:
m_WordDocument.Range.SetRange(theField.Result.Start, theField.Result.End)
m_WordDocument.Range.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
m_WordDocument.Range.Move(Word.WdUnits.wdCharacter, 1)
theField.Result.Start = 120 and theField.Result.End = 149. Before calling
"SetRange", the document range is 0..480. Strangely, after calling
"SetRange", the document range has not changed, even though I've passed in
120 and 149! It seems that "Range" stores the extent of the document, from
0...n. I want to be able to insert things at specific positions within the
document.
Previously I was doing this using Application.Selection.Range etc. However,
it quickly became apparent that Application.Selection refers to the
currently active document, which would knobble my application as soon as the
user opened another instance of word.
How can I manipulate the insertion point for the current document?
Thanks for any help you can give me.
Robin