View Full Version : Go to start of document with Word VBA
07-11-2009, 11:04 PM
I am adding a large number of lines to a table in Word, using VBA. The number of lines varies, but it is usually over several pages.
After the transfer of data to the table, how do I get back to the start of the table, or even the start of the document?
I have tried several statements, but all were unsuccessful
07-12-2009, 04:59 AM
Ordinarily, you should be able to do whatever you need to without the document having to scroll and, hence, needing to return to the start of the document afterwards. You can do this by using Range-based expressions instead of Selection-based expressions. Some complex Find/Replace operations are an exception (because of the need to use Selection-based expressions).
What is the code you're using that means you need to "get back to the start of the table, or even the start of the document"?
FWIW, to return to the place you had selected before executing a piece of code you can use something like:
Dim SelRng As Range
Set SelRng = Selection.Range
' Do stuff
or even the start of the document"?
07-13-2009, 12:05 PM
"I have tried several statements, but all were unsuccessful"
Please post what you have tried.
If you want to go back (that is, make the cursor, the Selection) to the start of the table you are working with, the best way - including actually working with the table - is to use a table object.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.