Help with using OnKey

K

keithb

When included in the "ThisWorkbook" Module, this code does caused the named
procedures to run when the described keys are pressed. Furthermore, when a
subroutine in that module runs, this code causes an error message stating:
"Only comments may appear after an End Sub, End Function, or End Property".
Does that mean that this code needs to be included in a subroutine?

Application.OnKey "%{LEFT}", "ShiftLeft"
Application.OnKey "%{RIGHT}", "ShiftRight"

Thanks,

Keith
 
J

Jim Thomlinson

Yup. That code that you have there needs to be in a subroutine. As a guess in
thisworkbook you probably want to place it in the workbook open sub.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top