View Single Post
 
Old 10-11-2016, 08:22 AM
Grasor Grasor is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jun 2015
Posts: 4
Grasor is on a distinguished road
Default Move Insertion Point with VBA

Hello All,

I'm new to using VBA in Word and am trying to just learn how to navigate a document and interact with content at a referenced position.

My current task is to move the cursor around the document and have the window scroll to the position of the cursor.

Here is what I'm using right now.

Code:
Sub MoveCursor()

Dim lStart As Long
 

lStart = Selection.Start ‘Returns Cursor’s Current Position

Selection.Goto(0) ‘Move Cursor (and scrolls Window) to top of document.

Selection.Start = lStart ‘Move’s Cursor, but does NOT scroll window. To position.


End Sub


The window scrolls to the top of the document on the .Goto(0) method but doesn't when I set Selection.Start = lStart

How can I make the window scroll to the cursor's position?

Thanks,
G
Reply With Quote