Solved

Word 2007 VBA - Reposition the cursor

Posted on 2011-03-25
3
789 Views
Last Modified: 2012-05-11
I wish to save the current cursor position at the start of a macro subroutine and then at the end of the sub reposition the cursor where it started fromj.

How would I do this?

TIA
0
Comment
Question by:Philip Pinnell
3 Comments
 
LVL 4

Accepted Solution

by:
jmdion earned 500 total points
ID: 35214098
This should work:
Sub DoSomething()

    Dim position As Range
    Set position = Selection.Range.Duplicate

    ' Do other things

    
    position.Select
    
End Sub

Open in new window

0
 
LVL 13

Author Comment

by:Philip Pinnell
ID: 35214163
Thanks. That seems to work a treat.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35214166
Not a direct answer, but it is usually possible, and, I think, better not to move the cursor during the macro.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now