Solved

Word 2007 VBA - Reposition the cursor

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

615 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