Solved

Word 2007 VBA - Reposition the cursor

Posted on 2011-03-25
3
785 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

747 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

13 Experts available now in Live!

Get 1:1 Help Now