tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
The following code was tested in Excel 2013, with the macro settings at option 4, ie Enable all macros (not recommended; potentially dangerous code can run).
These are the steps I took. Please try to follow it step by step to see if you get the same problem.
Firstly ensure the macro settings in Excel is set to:
I uploaded the workbook on the internet (say a Hotmail e-mail), then downloaded it onto my C drive.
Then I tried to open the file saved on my C drive via Windows Explorer.
When Excel opens, a message at the top shows:
To the right of this message is a button - Enable Editing
Once I clicked on the button, I get a VBA error:
When I click on Debug, this is the line it hangs on:
If I now close the workbook WITHOUT saving, then open it via Windows Explorer, it runs without any problems.
Subsequent times also work.
Why is Excel 2013 exhibiting this weird behaviour?
Thanks
Code:
Option Explicit
Private Sub Workbook_Open()
Application.OnKey Key:="^n", Procedure:=vbNullString
End Sub
These are the steps I took. Please try to follow it step by step to see if you get the same problem.
Firstly ensure the macro settings in Excel is set to:
Code:
Enable all macros (not recommended; potentially dangerous code can run).
I uploaded the workbook on the internet (say a Hotmail e-mail), then downloaded it onto my C drive.
Then I tried to open the file saved on my C drive via Windows Explorer.
When Excel opens, a message at the top shows:
Code:
PROTECTED VIEW Be careful - files from the internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View.
To the right of this message is a button - Enable Editing
Once I clicked on the button, I get a VBA error:
Code:
Run-time error '1004':
Method 'OnKey' of object '_Application' failed
When I click on Debug, this is the line it hangs on:
Code:
Application.OnKey Key:="^n", Procedure:=vbNullString
If I now close the workbook WITHOUT saving, then open it via Windows Explorer, it runs without any problems.
Subsequent times also work.
Why is Excel 2013 exhibiting this weird behaviour?
Thanks
Last edited: