A little more complicated, but I like the formatting better
Option Explicit
'Outside the subs, but inside the module
Dim StartTime As Date
Dim EndTime As Date
Dim Elapsed As Double
Private Sub Workbook_Open()
'Remember time when macro starts
StartTime = Now
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim iMinutes As Long
Dim dblSeconds As Double
EndTime = Now
Elapsed = 86400 * (EndTime - StartTime)
If Elapsed < 60 Then
MsgBox "This workbook open for " & Format(Elapsed, "#0.0") & " seconds", vbInformation + vbOKOnly
Else
iMinutes = Elapsed / 60
dblSeconds = Elapsed - (60 * iMinutes)
MsgBox "This workbook open for " & Format(iMinutes, "#") & ":" & Format(dblSeconds, "00") & " minutes", vbInformation + vbOKOnly
End If
End Sub