Username Log
Try this
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim sFilename As String
If SaveAsUI Then
Cancel = True
sFilename = Application.GetSaveAsFilename( _
fileFilter:="Microsoft Excel Files (*.xls), *.xls")
If sFilename < "False" Then
ThisWorkbook.SaveAs sFilename
Open ThisWorkbook.Path & "\usage.log" For Append As #1
Print #1, Environ("username"), Now, ThisWorkbook.FullName
Close #1
End If
End If
End Sub
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"PaulJ" wrote in message
...
Hi,
I'm using the following macro in the ThisWorkbook module which creates a
log
when somebody opens a file:
Private Sub Workbook_Open()
Open ThisWorkbook.Path & "\usage.log" For Append As #1
Print #1, Environ("username"), Now, ThisWorkbook.FullName
Close #1
End Sub
It works perfectly, but I only have it in a template. My question
therefore, is can the macro be adapted so that if someone opens the
template,
does File - Save As and renames it, this new file is also listed on the
log
without having to re-open it?
Hope this makes sense!
|