Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

how to select range of pages in MS Word?

 
Post new topic   Reply to topic    Computer Forum Forum Index -> word vba customization
View previous topic :: View next topic  
Author Message
Huub
Guest





PostPosted: Mon Apr 30, 2007 8:38 pm    Post subject: how to select range of pages in MS Word? Reply with quote

It is easy to select 1 page,the current page (Selection.GoTo
What:=wdGoToBookmark, Name:="\page"), but how to select multiple pages, eg
page 2 - 4
Back to top
Google
Sponsor





PostPosted: Mon Apr 30, 2007 8:38 pm    Post subject: Advertisement

Back to top
Jean-Guy Marcil
Guest





PostPosted: Mon Apr 30, 2007 9:16 pm    Post subject: Re: how to select range of pages in MS Word? Reply with quote

Huub was telling us:
Huub nous racontait que :

Quote:
It is easy to select 1 page,the current page (Selection.GoTo
What:=wdGoToBookmark, Name:="\page"), but how to select multiple
pages, eg page 2 - 4

Like this:

Dim rgePages As Range

Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=2

Set rgePages = Selection.Range

Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=4

rgePages.End = Selection.Bookmarks("\Page").Range.End

rgePages.Select

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Back to top
Huub
Guest





PostPosted: Tue May 01, 2007 5:42 pm    Post subject: Re: how to select range of pages in MS Word? Reply with quote

Jean-Guy
mercy beaucoup !
I did the selection range start/end thing and tried something with wdExtend,
but this is much simpeler!

Huub.

"Jean-Guy Marcil" wrote:

Quote:
Huub was telling us:
Huub nous racontait que :

It is easy to select 1 page,the current page (Selection.GoTo
What:=wdGoToBookmark, Name:="\page"), but how to select multiple
pages, eg page 2 - 4

Like this:

Dim rgePages As Range

Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=2

Set rgePages = Selection.Range

Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=4

rgePages.End = Selection.Bookmarks("\Page").Range.End

rgePages.Select

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Back to top
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> word vba customization All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Computer Forum