C
Conan Kelly
Hello all,
I have many long docs that I need to scan through to delete unnecessary stuff. Is there a way that I can scroll the window so that
the start of the selection is near the top of the window?
Here is part of the code that I am currently using:
Do While Selection.Find.Execute
' Selection.Find.Execute
'Assigns the selection starting position to a variable then collapses the selection.
plngSelectionStart = Selection.Start
Selection.Collapse
'Finds and selects the end of the 2nd row of column headings then assigns its end position to a variable
Selection.Find.Execute " Rate Contact^p"
plngSelectionEnd = Selection.End
'Selects the page & column headers and deletes them
Selection.Start = plngSelectionStart
Selection.End = plngSelectionEnd
ActiveWindow.SmallScroll -10
pmbrDeleteResponse = MsgBox("Do you want to delete this selection?", vbYesNoCancel + vbQuestion, "Delete Selection")
If pmbrDeleteResponse = vbYes Then
Selection.Delete
ElseIf pmbrDeleteResponse = vbCancel Then
Exit Sub
Else
Selection.Collapse 0
End If
'Resets the text to find back to the search string variable
'Otherwise the DO WHILE loop would continue to look for the end of the 2nd line of column headings
Selection.Find.Text = pstrSearchText
Loop
I tried using "ActiveWindow.SmallScroll -10" to scroll the window down 10 lines after it selects the text I'm looking for.
The problem is sometimes the selection can be 50 lines long and after the SmallScroll, I can only see the bottom 10 line. Or
sometime the very next block of text to find is already visible on the screen, and after it is selected, SmallScroll may kick it off
the bottom of the screen.
How can I edit this code to get the start of the selection to be scrolled to 5 lines down from the top of the window?
I have many long docs that I need to scan through to delete unnecessary stuff. Is there a way that I can scroll the window so that
the start of the selection is near the top of the window?
Here is part of the code that I am currently using:
Do While Selection.Find.Execute
' Selection.Find.Execute
'Assigns the selection starting position to a variable then collapses the selection.
plngSelectionStart = Selection.Start
Selection.Collapse
'Finds and selects the end of the 2nd row of column headings then assigns its end position to a variable
Selection.Find.Execute " Rate Contact^p"
plngSelectionEnd = Selection.End
'Selects the page & column headers and deletes them
Selection.Start = plngSelectionStart
Selection.End = plngSelectionEnd
ActiveWindow.SmallScroll -10
pmbrDeleteResponse = MsgBox("Do you want to delete this selection?", vbYesNoCancel + vbQuestion, "Delete Selection")
If pmbrDeleteResponse = vbYes Then
Selection.Delete
ElseIf pmbrDeleteResponse = vbCancel Then
Exit Sub
Else
Selection.Collapse 0
End If
'Resets the text to find back to the search string variable
'Otherwise the DO WHILE loop would continue to look for the end of the 2nd line of column headings
Selection.Find.Text = pstrSearchText
Loop
I tried using "ActiveWindow.SmallScroll -10" to scroll the window down 10 lines after it selects the text I'm looking for.
The problem is sometimes the selection can be 50 lines long and after the SmallScroll, I can only see the bottom 10 line. Or
sometime the very next block of text to find is already visible on the screen, and after it is selected, SmallScroll may kick it off
the bottom of the screen.
How can I edit this code to get the start of the selection to be scrolled to 5 lines down from the top of the window?