Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Thanked 0 Times in 0 Posts

    Positioning the cursor at the end of a doc (C++) (2000)


    I am writing an application in C++, thus using an OLE object to automate Word.
    The application needs to Paste the content of the Word.Selection at the end of a document.

    What are the various ways to position the "cursor" at the end of a document so that the selection is added to the doc ?
    I ask for various ways, because sometimes, the OLE doesn't give me all that is available in VB!

    Also, does anyone know where to find (online preferably) info about the Word objects, and more particularly their properties and functions.
    On MSN I found all the objects, but nothing about their properties and function.
    With such resource I guess I'll ask less silly questions on the board...


  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 93 Times in 89 Posts

    Re: Positioning the cursor at the end of a doc (C++) (2000)

    If you look up the documentation for the Developer Edition of Office on MSDN, you should find more comprehensive materials.

    Also, if you have an Office application, the internal VBA help is reasonably good.

    To "go to" the end of a document using the Selection object, the typical approach is to mimic the Ctrl+End functionality:

    Selection.EndKey Unit:=wdStory 'Warning: typed here without testing

    You also can paste at the end using a range object:

    myDocument.Range(ActiveDocument.Content.End - 1).Paste

    Naturally, if the clipboard doesn't need to be involved, there are many ways to insert strings. Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts