Code:
Sub Workbook_Open()
MsgBox "OK"
End Sub
Sub Workbook_BeforeClose(cancel As Boolean)
MsgBox "OK"
End Sub
The code above works perfect in a new excel workbook.
Opening the workbook a got a message to enable the macro's and the Workbook_Open macro is running after enabling the macro's.
Closing the document the Workbook_BeforeClose macro is also running perfect.
But after the document is marked as trusted, either marked as a trusted document or using a digital signature from a trusted publisher the Workbook_Open macro doesn't work anymore.
All other macro's in the document are working fine and also the Workbook_BeforeClose is activated closing the document.
After removing the mark as a trusted document, the message to enable all macro's is popping up again and the Workbook_Open macro is running again.....
Has someone an explanation why only the Workbook_Open macro doesn't work for trusted documents ???