Tables

B

Bny

I currently have Word 2007. I have a table document which I update on a
regular basis. It has has five columents and has rows pre-numbered in the
first column. The remaining four columns are required to be filled in.

Is there some way I can set it up to open at the last row worked on?
 
G

Graham Mayor

You need to create (or modify if they already exist) three macros. Each of
those calls a fourth, which is optional, and puts the path in the title bar.
If you don't want to use it delete the line InsertDocTitle from each of the
other macros. http://www.gmayor.com/installing_macro.htm . The macros put a
bookmark at the location where you last worked and allow the document to
open at that location. If you save the macros in the normal template. All
documents, saved after you install the macros, will open with the cursor at
the positions where you last saved them

Sub AutoOpen()
With ActiveWindow.View
.Type = wdPrintView
.TableGridlines = True
End With
ActiveWindow.View.ShowAll = False
ActiveWindow.View.ShowFieldCodes = False
'+++++++++++++++++++++++++++++++++++
'The macro needs the next segment
If ActiveDocument.Bookmarks.Exists("OpenAt") = True Then
ActiveDocument.Bookmarks("OpenAt").Select
End If
'+++++++++++++++++++++++++++++++++++
InsertDocTitle
End Sub

Sub FileSaveAs()
On Error Resume Next
ActiveDocument.Bookmarks.Add Range:=Selection.Range, name:="OpenAt"
Dialogs(wdDialogFileSaveAs).Show
InsertDocTitle
End Sub

Sub FileSave()
On Error Resume Next
ActiveDocument.Bookmarks.Add Range:=Selection.Range, name:="OpenAt"
ActiveDocument.Save
InsertDocTitle
End Sub

Sub InsertDocTitle()
' Changes window title to include path with filename
Dim NameArray As Variant
Dim NameStringL As String
Dim NameStringR As String
Dim Count As Long
Const maxLen = 120 ' set this value to fit your window width
' (avoid error if no active window)
If Windows.Count > 0 Then
NameStringL = ActiveDocument.FullName
If Len(NameStringL) > maxLen Then
' separate the folder names
NameArray = Split(NameStringL, "\")
' check the folder depth
Count = UBound(NameArray)
If Count > 3 Then
NameStringL = NameArray(0) & "\...\"
NameStringR = NameArray(Count)
Count = Count - 1
' continue adding folders to the left of the string
' until you run out of folders or one won't fit
Do While (Count > 0) And _
(Len(NameStringL) + Len(NameStringR) + _
Len(NameArray(Count)) < maxLen)
NameStringR = NameArray(Count) & "\" _
& NameStringR
Count = Count - 1
Loop

NameStringL = NameStringL & NameStringR
End If
End If
' Change the window's caption
ActiveWindow.Caption = NameStringL
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top