Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Saving the cursor position in Word docs and templates
Our company templates are suppose to have the cursor open to a specific line
when the template is opened. Upon our last update, the cursor now opens to line 1 instead of line 15. How do I get the cursor to open on a specific line? Thanks |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Saving the cursor position in Word docs and templates
You can copy the following macros into each template. They will place the
insertion point at the same location it was positioned when you last closed the document. The first inserts a bookmark at the position of the insertion point (not at the position of the last edit) every time you both issue the command to close a document *and* confirm in the resultant message box that you want to save the document. If you don't save the document when closing it the bookmark will not be inserted or if it was inserted previously it will remain in the previous location. Trap: Saving the document, then closing it and saying you do not want to save the document when prompted will not insert the bookmark or reposition it. You must *not* change either macro name -- AutoClose and AutoOpen. They are reserved for macros that automatically execute when you close any Word document and open any Word document, respectively. Macro #1 Sub AutoClose() 'To insert this bookmark each time, confirm that you want to save the document 'when closing it With ActiveDocument.Bookmarks ..Add Range:=Selection.Range, Name:="lastinsertionpointposition" ..DefaultSorting = wdSortByName ..ShowHidden = True End With End Sub Macro #2: Sub AutoOpen() ' goes to the bookmark set via the AutoClose macro if it exists, otherwise moves ' ' to the beginning of the document If ActiveDocument.Bookmarks.Exists("lastinsertionpoin tposition") = True Then Selection.GoTo What:=wdGoToBookmark, Name:="lastinsertionpointposition" End If End Sub To learn how to copy macros, read the following: http://www.gmayor.com/installing_macro.htm "Black Lab" wrote: Our company templates are suppose to have the cursor open to a specific line when the template is opened. Upon our last update, the cursor now opens to line 1 instead of line 15. How do I get the cursor to open on a specific line? Thanks |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Saving the cursor position in Word docs and templates
Is there anyone other way beside creating a Macro to do this? I have 60
templates to update. "Aeneas" wrote: You can copy the following macros into each template. They will place the insertion point at the same location it was positioned when you last closed the document. The first inserts a bookmark at the position of the insertion point (not at the position of the last edit) every time you both issue the command to close a document *and* confirm in the resultant message box that you want to save the document. If you don't save the document when closing it the bookmark will not be inserted or if it was inserted previously it will remain in the previous location. Trap: Saving the document, then closing it and saying you do not want to save the document when prompted will not insert the bookmark or reposition it. You must *not* change either macro name -- AutoClose and AutoOpen. They are reserved for macros that automatically execute when you close any Word document and open any Word document, respectively. Macro #1 Sub AutoClose() 'To insert this bookmark each time, confirm that you want to save the document 'when closing it With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="lastinsertionpointposition" .DefaultSorting = wdSortByName .ShowHidden = True End With End Sub Macro #2: Sub AutoOpen() ' goes to the bookmark set via the AutoClose macro if it exists, otherwise moves ' ' to the beginning of the document If ActiveDocument.Bookmarks.Exists("lastinsertionpoin tposition") = True Then Selection.GoTo What:=wdGoToBookmark, Name:="lastinsertionpointposition" End If End Sub To learn how to copy macros, read the following: http://www.gmayor.com/installing_macro.htm "Black Lab" wrote: Our company templates are suppose to have the cursor open to a specific line when the template is opened. Upon our last update, the cursor now opens to line 1 instead of line 15. How do I get the cursor to open on a specific line? Thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving cursor position in Word docs and templates | Microsoft Word Help | |||
MS Word document is opening to last cursor position | Microsoft Word Help | |||
Curser position on blank docs in Word 2003 | Microsoft Word Help | |||
Cursor position when opening Word | Microsoft Word Help | |||
How do I change the (position) cursor style in Word | Microsoft Word Help |