• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

Word 2007 VBA - Reposition the cursor

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
Atdhe Nuhiu
Asked:
Atdhe Nuhiu
1 Solution
 
jmdionCommented:
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
 
Atdhe NuhiuAuthor Commented:
Thanks. That seems to work a treat.
0
 
GrahamSkanRetiredCommented:
Not a direct answer, but it is usually possible, and, I think, better not to move the cursor during the macro.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now