Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function lngInsertBreak(lngBreakType As Long) As Long
' Procedure :   lngInsertBreak
' Description:  Insert a section break; workaround for BUG in Word97.
' Copyright: Chris Greaves Inc.
' Inputs:       Break type
' Returns:      LONG Count of page-breaks removed.
' Assumes:      Nothing
' Side Effects: Page break may be removed..
' Tested:       By the calls shown below.
    lngInsertBreak = 0
    If lngBreakType = wdSectionBreakContinuous Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        If Selection.Text = Chr(12) Then ' we have found a hard page-break or section break?
            Selection.Delete
            lngInsertBreak = 1
            Selection.InsertBreak Type:=wdSectionBreakNextPage
        Else
            Selection.InsertBreak Type:=lngBreakType
        End If
    Else
        Selection.InsertBreak Type:=lngBreakType
    End If
'Sub TESTlngInsertBreak()
'    MsgBox lngInsertBreak(wdSectionBreakContinuous)
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function lngInsertBreak(lngBreakType As Long) As Long
' Procedure :   lngInsertBreak
' Description:  Insert a section break; workaround for BUG in Word97.
' Copyright: Chris Greaves Inc.
' Inputs:       Break type
' Returns:      LONG Count of page-breaks removed.
' Assumes:      Nothing
' Side Effects: Page break may be removed..
' Tested:       By the calls shown below.
    lngInsertBreak = 0
    If lngBreakType = wdSectionBreakContinuous Then
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        If Selection.Text = Chr(12) Then ' we have found a hard page-break or section break?
            Selection.Delete
            lngInsertBreak = 1
            Selection.InsertBreak Type:=wdSectionBreakNextPage
        Else
            Selection.InsertBreak Type:=lngBreakType
        End If
    Else
        Selection.InsertBreak Type:=lngBreakType
    End If
'Sub TESTlngInsertBreak()
'    MsgBox lngInsertBreak(wdSectionBreakContinuous)
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1