Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I discover where the insertion point in word is?

Status
Not open for further replies.

nesplb

Programmer
Jul 29, 2003
109
NO
Hi! I want to check all the words from the beginning of a text in MS word to the place where the insertion point is (the caretposition). How can I write code to discover where this place is?

I also wonder if here is any event handling that can be used to notice when a user is clicking in a ordinary word document.

I'll be very thankful for all help!!
 
You can use the Selection object. The code below will select the text from the current insertion point to the start of the document.

Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
MsgBox Selection

The best way to get this type of code is to record a word macro with the steps you are doing and then inspect the code of the macro.
 
Thnak you for your help! It seems as if the macros only can be assigned to keyboard or buttons and not mouse events in the document...Is that right?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top