Hi All,
I haven’t done much with VB Components before. The macro I’m working on creates a new data book, and it would be ideal to have it put a workbook activate and workbook deactivate event on the ThisWorkbook module, just to assign and unassign OnKeys.. I’ve messed around a bit, modifying some code from Chip Pearson’s site, and managed to crash Excel with amazing consistency.
The text I was looking to put in ThisWorkbook is
“Option Explicit” & Chr(13) & _
“Private Sub Workbook_Activate()” & Chr(13) & _
“Application.OnKey “”{f10}””, “”SortTable””” & Chr(13) & _
“End Sub” & Chr(13) & _
Chr(13) & _
Private Sub Workbook_Deactivate()” & Chr(13) & _
“Application.OnKey “”{f10}””” & Chr(13) & _
“End Sub” & Chr(13)
What’s the best way to do this? Or is it foolish to attempt?
Thanks