Hi,

I was trying to adapt the code below, but failed miserably...



Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nm As Name, useDate As Date

On Error Resume Next
Set nm = ThisWorkbook.Names("FirstUse")
If Err Or nm Is Nothing Then
'this is first use, save the date
Err.Clear
ThisWorkbook.Names.Add _
Name:="FirstUse", _
Visible:=False, _
RefersTo:=Date

Else
'check today vs. first use
useDate = Right(nm.RefersTo, 5)
'MsgBox useDate
If DateDiff("d", useDate, Date) > 30 Then
ThisWorkbook.Close
End If
End If

End Sub

thanks