Move curser to bottom of page

L

LEU

I have the following macro that will put a Table of Content Marker in the
attachment sections of my document. How do I move the curser to the bottom of
the page before it puts in the marker?

Dim Msg, Style, Title, Response, MyString
Msg = "Do you want a Table of Content Marker?"
Style = vbYesNo + vbDefaultButton2
Title = "Table of Content Marker"

Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"ADVANCE \y 690", PreserveFormatting:=False
ActiveWindow.ActivePane.View.ShowAll = True
ActiveDocument.TablesOfContents.MarkEntry Range:=Selection.Range,
Entry:= _
TextBox1 & vbTab & TextBox2, EntryAutoText:="", TableID:="C" _
, Level:=2
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Me.Hide
TextBox1.Text = ""
TextBox2.Text = ""
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Me.Hide
TextBox1.Text = ""
TextBox2.Text = ""
End If
 
P

Pesach Shelnitz

You can use the predefined \Page bookmark to find the end of the current page
and move the cursor to its bottom. The \Page bookmark embraces the entire
current page, so if you select it, the entire page is selected. Collapsing
the selection doesn't work for me, so I use a couple of cursor movements to
place the cursor at the end of the selection, which is the end of the page.
The following code does it all.

ActiveDocument.Bookmarks("\Page").Select
If Selection.Start <> Selection.End Then
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If

Your macro does not work for me in its present state. I assume that you left
out some of the code, so I can't present a complete working macro that
performs the added step of moving the cursor to the bottom of the page, but I
think that if you add this code right before your line that adds an ADVANCE
field, you will have what you want.
 

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