Hi There,
Would you please let me know how to delete from first page until the first
section Break (Next page) in VBA?
Any help would be great.
Thanks,

Re: How to delete from first page to start of the next section break by Helmut

Helmut
Wed Oct 20 08:07:14 CDT 2004

Hi Leila,
first page included or not?
Here is an example, which includes the first page.
---
Dim rDcm As Range
Dim iSct As Integer
Set rDcm = ActiveDocument.Range
For iSct = 1 To rDcm.Sections.Count
If rDcm.Sections(iSct).PageSetup.SectionStart _
= wdSectionNewPage Then
rDcm.End = rDcm.Sections(iSct).Range.start
Exit For
End If
Next
rDcm.Select ' for testing only
rDcm.Delete
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000


Re: How to delete from first page to start of the next section bre by Leila

Leila
Wed Oct 20 13:55:04 CDT 2004


Thank you Helmut, your solution worked great.
"Helmut Weber" wrote:

> Hi Leila,
> first page included or not?
> Here is an example, which includes the first page.
> ---
> Dim rDcm As Range
> Dim iSct As Integer
> Set rDcm = ActiveDocument.Range
> For iSct = 1 To rDcm.Sections.Count
> If rDcm.Sections(iSct).PageSetup.SectionStart _
> = wdSectionNewPage Then
> rDcm.End = rDcm.Sections(iSct).Range.start
> Exit For
> End If
> Next
> rDcm.Select ' for testing only
> rDcm.Delete
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
>
>

Re: How to delete from first page to start of the next section bre by Helmut

Helmut
Wed Oct 20 14:12:09 CDT 2004

Hi Leila,
oops, beware !
working only if there is a section with
PageSetup.SectionStart = wdSectionNewPage
Put rDcm.Delete in the if-command, please.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/

Re: How to delete from first page to start of the next section bre by Leila

Leila
Wed Oct 20 16:39:04 CDT 2004

I did, thanks for the notice though :)

"Helmut Weber" wrote:

> Hi Leila,
> oops, beware !
> working only if there is a section with
> PageSetup.SectionStart = wdSectionNewPage
> Put rDcm.Delete in the if-command, please.
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/
>