Word Automation and Navigating

  1. 3 weeks ago

    Bryan D

    Feb 7 Pre-Release Testers, Xojo Pro

    I am trying to move the cursor to the end of a Microsoft Word document, but I cannot find the correct syntax.

    wordApp.Selection.EndKey Unit:=wdStory

    Gives an error with the word "Unit"

    I would like to try

    wordApp.Selection.GoTo(what, which, Nothing, Nothing)

    but I need objects for what and which, and I cannot find them. The VBA code is

    Dim what As Object = Word.WdGoToItem.wdGoToLine
    Dim which As Object = Word.WdGoToDirection.wdGoToLast

    But cannot locate any objects beginning with "wd"

    Have you tried:

    wordApp.Selection.EndKey(office.wdStory)
  2. 2 weeks ago

    Don L

    Feb 8 Pre-Release Testers, Xojo Pro Answer Florence, South Carolina USA
    Edited 2 weeks ago

    Have you tried:

    wordApp.Selection.EndKey(office.wdStory)
  3. Bryan D

    Feb 8 Pre-Release Testers, Xojo Pro

    Thanks Don

    It never crossed my mind to check the office object.

  4. Don L

    Feb 9 Pre-Release Testers, Xojo Pro Florence, South Carolina USA

    @Bryan D It never crossed my mind to check the office object.

    Do yourself a favor and invest in Eugene Dakin's "I Wish I Knew How To … " series of eBooks on MS Office Automation. He's got one on MS Word and one on MS Excel (along with a host of others on various Xojo-related topics) ... You can find them at xojolibrary.com

    Frankly, I couldn't do squat until I purchased them. MS Automation documentation is sparse at best (as I'm sure you have found). Within an hour after getting my first book from him, I was writing some pretty complex Xojo MS Word code doing some really neat things that got my customer's attention. The purchase price is a real "cheap date" ... it would cost you more for a meal for two at McDonalds than it does for one of his eBooks. His style of writing along with giving lots of examples makes it an easy read with quick comprehension. I refer back to them frequently ,,, they have become a mainstay of my Xojo reference library.

    Bite the bullet and get the eBooks from Eugene ... you won't regret it, I assure you!

  5. Alberto D

    Feb 9 Pre-Release Testers, Xojo Pro

    @Don L Do yourself a favor and invest in Eugene Dakin's "I Wish I Knew How To … " series of eBooks on MS Office Automation.

    +1

or Sign Up to reply!