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 / July 2007

Tip: Looking for answers? Try searching our database.

How to select the current page?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bertrand - 06 Jul 2007 14:54 GMT
Hi,

I need to "clone" the current page a number of times. I do this with a
Selection object by calling Copy and then Paste a number of times which works
fine. My problem is how to select the contents of the current page?

I have tried to select the current page (se sample below) by using
Selection.GoTo but this dos'ent work if I am on the first/last page because
the selection does not move. Then how do I do it?

Any help would be appreciated
Bertrand

' Trick to go to the top of the current page
Selection.GoTo(What:=wdGoToPage, Which:=wdGoToPrevious, Name:="").Select
Selection.GoTo(What:=wdGoToPage, Which:=wdGoToNext, Name:="").Select
' Enable selection mode
Selection.ExtendMode = True
' Go to the next page
Selection.GoTo(What:=wdGoToPage, Which:=wdGoToNext, Name:="").Select
' Copy
Selection.Copy
' Turn off selection mode
Selection.ExtendMode = False
' Go to the top of the page to avoid overwriting selection
Selection.GoTo(What:=wdGoToPage, Which:=wdGoToPrevious, Name:="").Select
' Now do the insert!
For i = 1 To Int(Val(NoOfPages))
   Selection.Paste
Next
Graham Mayor - 06 Jul 2007 15:37 GMT
If by copying the current page you can achieve what you want then

   ActiveDocument.Bookmarks("\page").Range.Select
   Selection.Copy

will copy the current page to the clipboard

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
>
[quoted text clipped - 27 lines]
>    Selection.Paste
> Next
Jonathan West - 09 Jul 2007 12:23 GMT
> If by copying the current page you can achieve what you want then
>
>    ActiveDocument.Bookmarks("\page").Range.Select
>    Selection.Copy
>
> will copy the current page to the clipboard

That can even be condensed into one line.

ActiveDocument.Bookmarks("\page").Range.Copy

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

 
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.