>loWord = CREATEOBJECT("Word.application") >WITH loWord > .Documents.Open("DocToOpen.doc") > > WITH .ActiveDocument > *Grab a reference to the existing text. > loSelection = .ActiveWindow.Selection > WITH loSelection > *Add Customer name and billing address. > .InsertAfter(lcCustName + CHR(13)) > .InsertAfter(lcAddr1 + CHR(13)) > IF !EMPTY(lcAddr2) > .InsertAfter(lcAddr2 + CHR(13)) > ENDIF > .InsertAfter(lcCityStZip + CHR(13) + CHR(13)) > > *Add salut, and default text > .InsertAfter(lcSalut + "," + CHR(13)) > .InsertAfter("Some introductory text goes here:" + CHR(13)) > *Then move down one line. > .MoveDown(,1,) > *Scan the cursor and add items as necessary. > SELECT TestCursor > SCAN > *Check where we are on the page...need a minimum of 4 lines. > If (There isn't enough space, this is the code I need) > *Add a page break. > .InsertBreak(0) > Endif > .InsertAfter(FieldValue1 + CHR(13)) > .InsertAfter(FieldValue2 + CHR(13)) > .InsertAfter(FieldValue3 + CHR(13)) > .InsertAfter(FieldValue4 + CHR(13)) > ENDSCAN > ENDWITH > ENDWITH >ENDWITH >>I've tried a whole series of object and method combinations but haven't been able to locate the one for line numbers. Paragraphs, yes, but line numbers, no. I also realize there are other ways to do what I'm trying to do. I'm open to any suggestions, as long as they move me in the right direction. Thanks in advance.
lnOnPage = loWord.Selection.Information(wdActiveEndPageNumber) .InsertAfter(FieldValue1 + CHR(13)) .InsertAfter(FieldValue2 + CHR(13)) .InsertAfter(FieldValue3 + CHR(13)) if loWord.Selection.Information(wdActiveEndPageNumber) > m.lnOnPage .MoveUp(,3) .InsertBreak(0) * go to end endif .InsertAfter(FieldValue4 + CHR(13))PS: You're inserting lines with CR. So in fact aren't Lines = Paragraphs?