I have a "Workbook_Open" running in a file however when the file is opened from an email, it always fails when the user clicks "enable editing".
I still want it to run when you open the file normally but not when you open from an email. Anyone know how to stop this, or have a look at my code why it doesn't run when you open it in an email (i have underlined the code the debugger highlights)?
Private Sub Workbook_Open()
Dim varRes As Variant
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
Application.ScreenUpdating = False
With Worksheets("Rota")
If .Range("B4").Value <= Date And .Range("B693").Value >= Date Then
On Error Resume Next
varRes = WorksheetFunction.Match(Worksheets("Mandec Extract 2").Range("R1"), .Columns(1), 0)
On Error GoTo 0
If (Not IsError(varRes) And Len(varRes) > 0) Then Application.GoTo .Cells(varRes, 1), True
End If
End With
Application.ScreenUpdating = True
End Sub
Thanks for any help
John
Bookmarks