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 lngGoToPage(intPosition As Integer, lngPageNumber As Long) As Long
' Procedure :   lngGoToPage
' Description:  Position the text cursor at the top or bottom of a specified page.
' Copyright: Chris Greaves Inc.
' Inputs:       Offset to position on page.
'               Page number of interest.
' Returns:      LONG Page number
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls shown below.
'   If we have to got bottom, we must move to the next page and back up.
    If intPosition = intcBottomOfPage Then
        Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Name:=lngPageNumber + 1
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Else
        ' If we want the current page, nothing to do
        If lngGetCurrentPageNumber(0) = lngPageNumber Then
        Else ' we end up at the top of the required page.
            Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Name:=lngPageNumber
        End If
    End If
'Sub TESTlngGoToPage()
'    MsgBox lngGoToPage(1, lngGetCurrentPageNumber(-1))
'    MsgBox lngGoToPage(0, lngGetCurrentPageNumber(-1))
'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 lngGoToPage(intPosition As Integer, lngPageNumber As Long) As Long
' Procedure :   lngGoToPage
' Description:  Position the text cursor at the top or bottom of a specified page.
' Copyright: Chris Greaves Inc.
' Inputs:       Offset to position on page.
'               Page number of interest.
' Returns:      LONG Page number
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls shown below.
'   If we have to got bottom, we must move to the next page and back up.
    If intPosition = intcBottomOfPage Then
        Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Name:=lngPageNumber + 1
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Else
        ' If we want the current page, nothing to do
        If lngGetCurrentPageNumber(0) = lngPageNumber Then
        Else ' we end up at the top of the required page.
            Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, Name:=lngPageNumber
        End If
    End If
'Sub TESTlngGoToPage()
'    MsgBox lngGoToPage(1, lngGetCurrentPageNumber(-1))
'    MsgBox lngGoToPage(0, lngGetCurrentPageNumber(-1))
'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