Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Changing the selection position

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S Shulman - 10 Nov 2004 15:18 GMT
Hi all

I woder whether there is any way of changing the position of the selection
to another position e.g. a cell in a table
or just Go to end of document, beginning of document etc.

Thank you in advance
Shmuel
Jay Freedman - 10 Nov 2004 15:32 GMT
> Hi all
>
[quoted text clipped - 4 lines]
> Thank you in advance
> Shmuel

Hi Shmuel,

There are dozens of ways!

- You can use various methods of the Selection object: Selection.HomeKey,
Selection.EndKey, Selection.Move, MoveWhile, MoveUntil, MoveStart, MoveEnd,
etc...
- You can use the .Select method of many different kinds of objects: For
example, ActiveDocument.Paragraphs(1).Select will select the first paragraph
in the document, and ActiveDocument.Tables(1).Cell(2,3).Select will select
the cell in row 2 and column 3 of the first table in the document.
- You can use the Selection.Find property to move the selection to some
particular text or formatting you can search for.

All of these things are described in the VBA help. The quickest way to get
there is to type the word Selection in the VBA editor and press F1.

When you get more sophisticated about Word and VBA, you should look at using
a Range object instead of the Selection object for most work. Here's a
reference:
http://msdn.microsoft.com/library/en-us/modcore/html/decontheselectionobjectvsra
ngeobject.asp


Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

Helmut Weber - 10 Nov 2004 15:35 GMT
Hi,
thousand and more ways!
Have you tried to use the macro-recorder
and to record a changing of the selection?
As far as tables are concerned, like this:
ActiveDocument.Tables(1).Cell(1, 1).Select
Note that cell is defined by row and column,
... cell(rwo,column).select
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.