Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

Code to go to first character in the page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeanmac - 14 Sep 2005 15:57 GMT
Does anyone know a piece of code that would move you to the first character
in the current page of a document?  I am new to Word VBA and finding it not
the easiest, if anyone can help that would be great.

Many thanks
Jeanmac
KePaHa - 14 Sep 2005 16:10 GMT
I believe this will do so:

Sub Macro1()

With Application.Browser
   .Target = wdBrowsePage
   .Previous
End With

End Sub

> Does anyone know a piece of code that would move you to the first character
> in the current page of a document?  I am new to Word VBA and finding it not
> the easiest, if anyone can help that would be great.
>
> Many thanks
> Jeanmac
jeanmac - 14 Sep 2005 17:07 GMT
Thaks for getting back to me.  The code you gave me takes me to the top of
the previous page not the current one, I can't find the reference forthe
current page, can you help?  Thanks.

> I believe this will do so:
>
[quoted text clipped - 13 lines]
> > Many thanks
> > Jeanmac
Christian Freßdorf - 14 Sep 2005 16:21 GMT
Hi

> Does anyone know a piece of code that would move you to the first character
> in the current page of a document?  I am new to Word VBA and finding it not
> the easiest, if anyone can help that would be great.

this moves the selection before the first char of the page

Sub FirstCharOfPage()
Selection.Bookmarks("\Page").Select
Selection.Collapse wdCollapseStart
End Sub

Signature

regards Christian
~~~~~~~~~~~~~~~~
reply only to this newsgroup
http://www.mvps.org/word/FindHelp/Posting.htm

jeanmac - 14 Sep 2005 17:11 GMT
Perfect!!! THANKYOU.

> Hi
>
[quoted text clipped - 8 lines]
> Selection.Collapse wdCollapseStart
> End Sub
Aminc - 15 Sep 2005 22:05 GMT
Try this:
Dim iGoTo ' declare variable to store value of current page

iGoTo = Selection.Information(wdActiveEndPageNumber) ' get and store current
page#
Selection.GoTo What:=wdGoTopage, Which:=wdGoToNext, Name:=2 ' go to page
number stored previously.

Cursor will be positioned on the first line before first char.
Signature

AminC

> Perfect!!! THANKYOU.
>
[quoted text clipped - 10 lines]
> > Selection.Collapse wdCollapseStart
> > End Sub
Aminc - 15 Sep 2005 22:11 GMT
sorry, Replace line "Selection.GoTo What:=wdGoTopage, Which:=wdGoToNext,
Name:=2" with "Selection.GoTo What:=wdGoTopage, Which:=wdGoToNext,
Name:=iGoTo"
Signature

AminC

> Try this:
> Dim iGoTo ' declare variable to store value of current page
[quoted text clipped - 20 lines]
> > > Selection.Collapse wdCollapseStart
> > > End Sub
jeanmac - 17 Sep 2005 15:32 GMT
Thank you for replying to my post.  You have given me another very useful
piece of code and I appreciate it.

Jeanmac

> sorry, Replace line "Selection.GoTo What:=wdGoTopage, Which:=wdGoToNext,
> Name:=2" with "Selection.GoTo What:=wdGoTopage, Which:=wdGoToNext,
[quoted text clipped - 24 lines]
> > > > Selection.Collapse wdCollapseStart
> > > > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.