Re: Determining which type of breaks are present on a page?
- From: Helmut Weber <red.sys@xxxxxxxxxxx>
- Date: Thu, 23 Jun 2005 16:28:24 +0200
Hi Ken,
I think me need a more professional approach.
Still one more example for chr($12).
If the character after the selected character 12
is still in the same section, then we've found
an ordinary page break.
Otherwise we check pagesetup.sectionstart
as we did already. Don't forget to take care
of resetting search options, as mentioned before.
Sub test012()
Dim rDcm As Range ' the documents range
Set rDcm = ActiveDocument.Range
Selection.StartOf Unit:=wdStory, Extend:=wdMove
With Selection.Find
.Text = Chr(12)
While .Execute
MsgBox KindofBreak12(Selection.Range)
Wend
End With
'wdSectionContinuous ' 0
'wdSectionNewColumn ' 1
'wdSectionNewPage ' 2
'wdSectionEvenPage ' 3
'wdSectionOddPage '4
End Sub
Public Function KindofBreak12(ByVal rTmp As Range) As String
Dim lSct1 As Long ' counter for sections
Dim lSct2 As Long ' counter for sections
Dim lKoSc As Long ' kind of section.pagesetup.sectionstart
rTmp.Start = ActiveDocument.Range.Start
lSct1 = rTmp.Sections.Count ' count sections
rTmp.End = rTmp.End + 1 ' extend range
lSct2 = rTmp.Sections.Count ' count sections again
If lSct1 = lSct2 Then ' next caracter is in the same section
KindofBreak12 = "ordinary page break"
Exit Function
End If
' next character is in the next section
lKoSc = ActiveDocument.Sections(lSct2).PageSetup.SectionStart
Select Case lKoSc
Case 0: KindofBreak12 = "wdSectionContinuous"
Case 2: KindofBreak12 = "wdSectionNewPage"
Case 3: KindofBreak12 = "wdSectionEvenPage"
Case 4: KindofBreak12 = "wdSectionOddPage"
End Select
End Function
Greetings from Bavaria, Germany
Helmut Weber, MVP, WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
.
- Follow-Ups:
- References:
- Determining which type of breaks are present on a page?
- From: MrBo
- RE: Determining which type of breaks are present on a page?
- From: Helmut Weber
- Re: Determining which type of breaks are present on a page?
- From: MrBo
- Re: Determining which type of breaks are present on a page?
- From: Helmut Weber
- Re: Determining which type of breaks are present on a page?
- From: Ken McGowen
- Re: Determining which type of breaks are present on a page?
- From: Helmut Weber
- Re: Determining which type of breaks are present on a page?
- From: kkmcg
- Determining which type of breaks are present on a page?
- Prev by Date: Append Documents
- Next by Date: Wizard for Documentation that works with ReqPro.
- Previous by thread: Re: Determining which type of breaks are present on a page?
- Next by thread: Re: Determining which type of breaks are present on a page?
- Index(es):
Relevant Pages
|