View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default How do I log everytime an excel workbook is opened?

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

"bmarks" skrev i melding
...
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?