Prev: How do I alter default to turn off superscript for numbers, dates
Next: Exportasfixedformat - selective pages only
From: andreas on 20 Dec 2009 17:17 Dear Experts: I would like to know whether it is possible to retrieve the number of even-page section breaks in the current document and display the result in a MsgBox? Help is much appreciated. Thank you very much in advance. Regards, Andreas
From: Jay Freedman on 20 Dec 2009 18:35 On Sun, 20 Dec 2009 14:17:42 -0800 (PST), andreas <andreas.hermle(a)gmx.de> wrote: >Dear Experts: > >I would like to know whether it is possible to retrieve the number of >even-page section breaks in the current document and display the >result in a MsgBox? > >Help is much appreciated. Thank you very much in advance. > >Regards, Andreas Sub CountEvenPageSectionBreaks() Dim oSec As Section Dim EvenCount As Long For Each oSec In ActiveDocument.Sections If oSec.PageSetup.SectionStart = wdSectionEvenPage Then EvenCount = EvenCount + 1 End If Next MsgBox EvenCount & " Even Page section break(s)" End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
From: Greg Maxey on 20 Dec 2009 19:18 On Dec 20, 6:35 pm, Jay Freedman <jay.freed...(a)verizon.net> wrote: > On Sun, 20 Dec 2009 14:17:42 -0800 (PST), andreas > > <andreas.her...(a)gmx.de> wrote: > >Dear Experts: > > >I would like to know whether it is possible to retrieve the number of > >even-page section breaks in the current document and display the > >result in a MsgBox? > > >Help is much appreciated. Thank you very much in advance. > > >Regards, Andreas > > Sub CountEvenPageSectionBreaks() > Dim oSec As Section > Dim EvenCount As Long > > For Each oSec In ActiveDocument.Sections > If oSec.PageSetup.SectionStart = wdSectionEvenPage Then > EvenCount = EvenCount + 1 > End If > Next > > MsgBox EvenCount & " Even Page section break(s)" > End Sub > > -- > Regards, > Jay Freedman > Microsoft Word MVP FAQ:http://word.mvps.org > Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Hi Jay, I was toying with something similar when your post appeared. If the first section starts as a even page section I wander if it should be counted as break? Sub CountEvenPageSectionBreaks() Dim i As Long Dim Cnt As Long 'start with section 2 For i = 2 To ActiveDocument.Sections.Count If ActiveDocument.Sections(i).PageSetup.SectionStart = wdSectionEvenPage Then Cnt = Cnt + 1 End If Next MsgBox Cnt End Sub
From: Jay Freedman on 20 Dec 2009 19:35 Hi Greg On Sun, 20 Dec 2009 16:18:06 -0800 (PST), Greg Maxey <gmaxey(a)gmail.com> wrote: >On Dec 20, 6:35�pm, Jay Freedman <jay.freed...(a)verizon.net> wrote: >> On Sun, 20 Dec 2009 14:17:42 -0800 (PST), andreas >> >> <andreas.her...(a)gmx.de> wrote: >> >Dear Experts: >> >> >I would like to know whether it is possible to retrieve the number of >> >even-page section breaks in the current document and display the >> >result in a MsgBox? >> >> >Help is much appreciated. Thank you very much in advance. >> >> >Regards, Andreas >> >> Sub CountEvenPageSectionBreaks() >> � � Dim oSec As Section >> � � Dim EvenCount As Long >> >> � � For Each oSec In ActiveDocument.Sections >> � � � � If oSec.PageSetup.SectionStart = wdSectionEvenPage Then >> � � � � � � EvenCount = EvenCount + 1 >> � � � � End If >> � � Next >> >> � � MsgBox EvenCount & " Even Page section break(s)" >> End Sub >> >> -- >> Regards, >> Jay Freedman >> Microsoft Word MVP � � � �FAQ:http://word.mvps.org >> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. > >Hi Jay, > >I was toying with something similar when your post appeared. If the >first section starts as a even page section I wander if it should be >counted as break? > >Sub CountEvenPageSectionBreaks() >Dim i As Long >Dim Cnt As Long >'start with section 2 >For i = 2 To ActiveDocument.Sections.Count > If ActiveDocument.Sections(i).PageSetup.SectionStart = >wdSectionEvenPage Then > Cnt = Cnt + 1 > End If >Next >MsgBox Cnt >End Sub > > > You're correct. I don't think I've ever set the first section to start on an even page by setting its .SectionStart, only by changing the page number (which is what the Envelope > Add to Document does when it adds page 0). But if someone does that, it shouldn't count as an even section break. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
From: andreas on 21 Dec 2009 04:08
On 21 Dez., 01:18, Greg Maxey <gma...(a)gmail.com> wrote: > On Dec 20, 6:35 pm, Jay Freedman <jay.freed...(a)verizon.net> wrote: > > > > > > > On Sun, 20 Dec 2009 14:17:42 -0800 (PST), andreas > > > <andreas.her...(a)gmx.de> wrote: > > >Dear Experts: > > > >I would like to know whether it is possible to retrieve the number of > > >even-page section breaks in the current document and display the > > >result in a MsgBox? > > > >Help is much appreciated. Thank you very much in advance. > > > >Regards, Andreas > > > Sub CountEvenPageSectionBreaks() > > Dim oSec As Section > > Dim EvenCount As Long > > > For Each oSec In ActiveDocument.Sections > > If oSec.PageSetup.SectionStart = wdSectionEvenPage Then > > EvenCount = EvenCount + 1 > > End If > > Next > > > MsgBox EvenCount & " Even Page section break(s)" > > End Sub > > > -- > > Regards, > > Jay Freedman > > Microsoft Word MVP FAQ:http://word.mvps.org > > Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. > > Hi Jay, > > I was toying with something similar when your post appeared. If the > first section starts as a even page section I wander if it should be > counted as break? > > Sub CountEvenPageSectionBreaks() > Dim i As Long > Dim Cnt As Long > 'start with section 2 > For i = 2 To ActiveDocument.Sections.Count > If ActiveDocument.Sections(i).PageSetup.SectionStart = > wdSectionEvenPage Then > Cnt = Cnt + 1 > End If > Next > MsgBox Cnt > End Sub- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - Hi Greg, thank you very much for your looking into this matter a little deeper. It works just fine. Regards, Andreas |