Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-30-2020, 08:24 PM
gmayor's Avatar
gmayor gmayor is offline Returning to the pane (and maybe point) that the cursor was when the macro started Windows 10 Returning to the pane (and maybe point) that the cursor was when the macro started Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can either set a range at the start and select the range at the end e.g.


Code:
Dim oRng As Range
Set oRng = Selection.Range
'
'Do stuff
'
'
oRng.Select
or use ranges and don't move the selection e.g.
Code:
Sub TNR()
Dim oStory As Range
    For Each oStory In ActiveDocument.StoryRanges
        oStory.Font.Name = "Times New Roman"
        If oStory.StoryType <> wdMainTextStory Then
            While Not (oStory.NextStoryRange Is Nothing)
                Set oStory = oStory.NextStoryRange
                oStory.Font.Name = "Times New Roman"
            Wend
        End If
    Next oStory
lbl_Exit:
    Set oStory = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
pane view variable



Similar Threads
Thread Thread Starter Forum Replies Last Post
excel macro returning the wrong value anne.kiss@ntlworld.com Excel Programming 7 03-14-2019 05:53 AM
OneNote Undo: Insertion point/cursor "jumps" when typing Ctrl+Z aspiringgeek OneNote 0 03-21-2017 07:23 PM
Returning to the pane (and maybe point) that the cursor was when the macro started Cursor location on first click -- insertion point stevec5088 Word 1 12-14-2016 02:45 PM
Returning to the pane (and maybe point) that the cursor was when the macro started Cursor in reading pane Danny DeLoach Outlook 2 08-16-2011 11:58 AM
A macro to mirror the movement of the cursor ACA Word VBA 0 08-24-2010 03:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft