Jeg tror jeg har fundet noget:
http://www.mrexcel.com/forum/showthread.php?t=75570Her står bl.a.
SPØRGSMÅL:
Does anyone know if it is possible to have a macro running in the background to monitor what workbooks are being opened and rejecting and accepting them based on whether the workbook name meets certain criteria?
SVAR:
Well one alternative would be to use an Application Level event routine. Have a look at Chip's site here for some more info:
http://www.cpearson.com/excel/AppEvent.htmAs an example, add a new class module called "EventClass" and add the following code to it:
Code:
Public WithEvents App As Application
Private Sub App_WorkbookOpen(ByVal Wb As Excel.Workbook)
MsgBox "Opened : " & Wb.Name
End Sub
and in the Workbook_Open event add the following:
Code:
Dim AppClass As New EventClass
Private Sub Workbook_Open()
Set AppClass.App = Application
End Sub
That should at least get you started