View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Reset the macro assigned to Ctrl+F on workbook deactivate



Looks like you will have to use this ...
'--
Sub WorkBook_Deactivate()
Application.CommandBars(1).Controls("Edit").Contro ls("Find...").Reset
End Sub
'--
It appears OnKey won't restore menu commands just normal keyboard strokes.
--
Jim Cone
Portland, Oregon USA




"swtupr"
wrote in message
Ctrl+f doesnt work when i open another new workbook not a new sheet
in the same workbook where i have the code.
I have the code in my ThisWorkBook module not in Sheet module.
Hope i am clear now....




"Jim Cone" wrote:
"when i open some other excel sheet"

Do you mean "when I switch to another sheet" and not
"when I open another workbook" ?
If so your code belongs in the Sheet module of each sheet where
you want OnKey to work. The code would go in these subs ...

Private Sub Worksheet_Activate()
Private Sub Worksheet_Deactivate()
--
Jim Cone
Portland, Oregon USA