I have an Excel 2010 template with extensive VBA code which runs without errors when fired up from any location on my laptop. When I test accessing it through my organisation's intranet (it needs to be accessed by around 300 staff), it downloads to the Downloads folder and, when opened from there it is in Protected View and throws a 1004 error in the WorkBook_AfterOpen procedure. Disabling opening in Protected View is not an option. If I then retry to open the file, there is no error.

It may be a timing error as described here:

http://answers.microsoft.com/en-us/o...d-7a6204704d86

I've tried implementing the OnTime method without success. Here is my code:

Public Sub Workbook_Open()
    Application.OnTime Now + TimeSerial(0, 0, 30), "ThisWorkbook.Workbook_AfterOpen"
End Sub

Public Sub Workbook_AfterOpen()
    'Initialisation stuff here
    'Mostly OnKey assignments
End Sub
Can anyone help? I'm pretty sure that my code is bug-free as it runs fine when fired up in non-protected view from the desktop. I think that it's a higher-order Excel timing problem.

Thanks in advance

Iain