How do I log everytime an excel workbook is opened?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have user name and password applied to a workbook I'm creating. Anyone
know the basic code used to log everytime a user accesses the workbook and
when?
 
Hi

Goes in the ThisWorkbook module of the file:

Private Sub Workbook_Open()
Dim iFNum As Integer
iFNum = FreeFile
Open "C:\Temp\Log.txt" For Append As #iFNum
Print #iFNum, ThisWorkbook.FullName & " opened " & _
Now & " by " & Environ("username") & " on pc " & _
Environ("computername")
Close #iFNum
End Sub

Change filepath to fit, it should be on a network drive with write access
for everyone (a thing that doesn't seem to exist anymore in
corporations...)

HTH. Best wishes Harald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top