Control Reference > VSPrinter Control > VSPrinter Methods > ScrollIntoView Method |
Scrolls the control so the specified rectangle or point is visible.
[form!]VSPrinter.ScrollIntoView Left As Variant, Top As Variant, [ Right As Variant ], [ Bottom As Variant ]
Use this method when you want to make sure a specific part of a document is visible to the user.
For example, the code below looks for a string in a document and shows it to the user:
' ** search for the text:
' returns page and sets (X1,Y1,X2,Y2) to bounding box
Dim pg&
pg = vp.FindText("Hello")
' ** if the text was found, show it to the user
If pg > 0 Then
vp.PreviewPage = pg
vp.ScrollIntoView vp.X1 - 200, vp.Y1 - 200, vp.X2 + 200, vp.Y2 + 200
End If