Word Automation and Navigating

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:


Thanks Don

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!