Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-30-2020, 08:04 PM
MrConfused MrConfused 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 2010
Novice
Returning to the pane (and maybe point) that the cursor was when the macro started
 
Join Date: Sep 2020
Posts: 1
MrConfused is on a distinguished road
Default Returning to the pane (and maybe point) that the cursor was when the macro started

I apologize if this is too simple. I'm new at this.

I have a macro that changes all text in the main document, header, and footer to Times New Roman font (see below). At the end, it goes to the end of the main document. I would rather it go back to whatever pane was active when the macro started. Even better would be for it to go back to the exact point the cursor was at when it started. I tried lots of variations on setting dimensions of myvariable to various options, then tried setting myvariable=ActiveWindow.ActivePane.View or ActiveWindow.ActivePane.View.SeekView, etc., then at the end of the macro, ActiveWindow.ActivePane.View.SeekView = myhvariable But whatever specific variable type and syntax I need, I couldn't find. Please help.

Sub TNR()
'
' Change all fonts to Times New Roman
'
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.WholeStory


Selection.Font.Name = "Times New Roman"

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Font.Name = "Times New Roman"

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.Font.Name = "Times New Roman"

ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.EndOf
End Sub
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 07:01 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