How can I set a Range from Page X to Page Y 
Author Message
 How can I set a Range from Page X to Page Y

I am trying to use VBA to set a range from Page X to Page Y.  X and Y can be
any number. I would like to say set a Range that includes Page 2 to 7. I
need to Delete this range or apply changes that apply only to  that Range in
the document.

Any ideas on how to do this would be appreciated.



Thu, 12 Aug 2004 06:59:02 GMT  
 How can I set a Range from Page X to Page Y
Hi Bobby

Dim StartRange As Range, EndRange As Range
Set StartRange = ActiveDocument.Range
Set StartRange = StartRange.GoTo(What:=wdGoToPage, Name:="2")

Set EndRange = ActiveDocument.Range
Set EndRange = EndRange.GoTo(What:=wdGoToPage, Name:="8")
EndRange.Move unit:=wdCharacter, Count:=-1

EndRange.Start = StartRange.Start

Regards

Dave


|
| I am trying to use vba to set a range from Page X to Page Y.  X and Y can
be
| any number. I would like to say set a Range that includes Page 2 to 7. I
| need to Delete this range or apply changes that apply only to  that Range
in
| the document.
|
| Any ideas on how to do this would be appreciated.
|
|
|
|



Thu, 12 Aug 2004 07:22:16 GMT  
 How can I set a Range from Page X to Page Y
This works for me.

Thanks.


Quote:
> Hi Bobby

> Dim StartRange As Range, EndRange As Range
> Set StartRange = ActiveDocument.Range
> Set StartRange = StartRange.GoTo(What:=wdGoToPage, Name:="2")

> Set EndRange = ActiveDocument.Range
> Set EndRange = EndRange.GoTo(What:=wdGoToPage, Name:="8")
> EndRange.Move unit:=wdCharacter, Count:=-1

> EndRange.Start = StartRange.Start

> Regards

> Dave



> |
> | I am trying to use vba to set a range from Page X to Page Y.  X and Y
can
> be
> | any number. I would like to say set a Range that includes Page 2 to 7. I
> | need to Delete this range or apply changes that apply only to  that
Range
> in
> | the document.
> |
> | Any ideas on how to do this would be appreciated.
> |
> |
> |
> |



Thu, 12 Aug 2004 22:27:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Setting Range to Page Number

2. How do I Set Printout Page Range?

3. Canned pages....

4. Very simple Range question - beggining the range on 3rd page onwards

5. Page size for the background= Page size of the first page of the drawing

6. Page Footer on Page 1 Refers to Page 2

7. Page n of Total pages (or Max Pages function)

8. SendObject - controlling the range of pages in the report

9. Printing Specific or Range of Pages

10. How to initialize Range with current Page

11. Print Page Range Question

12. How to initialize Range object with Current page

 

 
Powered by phpBB® Forum Software