How to select the current page?

B

Bertrand

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
 
G

Graham Mayor

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

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Jonathan West

Graham Mayor said:
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
 

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