Ctrl+PgUp and Ctrl+PgDn

  • Thread starter Thread starter Keith Hueston
  • Start date Start date
K

Keith Hueston

I have a workbook in Excel 97 with two windows. One is
PipeBook.xls:1 and the other is PipeBook.xls:2. I would
like to disable the function of Ctrl+PgUp and Ctrl+PgDn in
the window PipeBook.xls:2, however leave the function
available for window PipeBook.xls:1. Is that possible?
 
take a look at SCROLLAREA in vba help.Put your code in the ThisWorkbook
module in the Open_Workbook macro.
 
Hi Keith Hueston,

Try this:
- Open your Workbook;
- Press Alt+F11 to open VBE window;
- Double click on ThisWorkbook object;
- Insert the code below:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
If Wn.Caption = "PipeBook.xls:2" Then
Application.OnKey "^{PGUP}", ""
Application.OnKey "^{PGDN}", ""
Else
Application.OnKey "^{PGUP}"
Application.OnKey "^{PGDN}"
End If
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.OnKey "^{PGUP}"
Application.OnKey "^{PGDN}"
End Sub


HTH
 
Back
Top