Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Word 2007 VBA - Reposition the cursor

Posted on 2011-03-25
3
Medium Priority
?
816 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
jmdion earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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