Updated to Office 2013 - VBA no longer works

Chrican

New Member
Joined
Jul 18, 2011
Messages
44
Had a simple code to disable the F1 key that worked great in Excel 2010, got force updated to '13 over the weekend and now I get this error when I launch Excel:

Code:
Run-time error '50290':
Method 'OnKey' of object '_Application' failed

And the code I use is this, saved into ThisWorkbook on the Personal.xlsb:
Code:
Private Sub Workbook_Open()'
' DisableF1 Macro
'
Application.OnKey "{F1}", vbNullString
'
End Sub

Did 2013 discontinue something? Is there an updated code I can use? Any tips/help/etc? I hate that pesky F1 key with a passion... I'm no VBA expert, I just copied that macro off this forum a few years back I think.

Thanks,
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
No this code should "just work". However you could try this:

In a normal module:
Code:
Sub ContinueOpen()'
Application.OnKey "{F1}", vbNullString
End Sub
in ThisWorkbook:
Code:
Private Sub Workbook_Open()'
Application.OnTime Now, "'" & Thisworkbook.FullName & "'!ContinueOpen"
End Sub
 
Upvote 0
Thanks for the reply and sorry for the delay following up, was out of town

I ended up asking the new resident excel wizard and turns out, for some reason, the private part of Private Sub doesn't work. Convert to just normal Sub and it works no problem. Odd...
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top