View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Eduardo Eduardo is offline
external usenet poster
 
Posts: 2,276
Default logging user name after viewing protected workbook

Hi,
see if this solution given in the community helps you

A simple text file should be OK, call this in the open event

Sub test()
Dim sFile As String
Dim sText
Dim ff As Long

sFile = Application.DefaultFilePath
' or maybe
'sFile = ThisWorkbook.Path
If Right$(sFile, 1) < "\" Then sFile = sFile & "\"

sFile = sFile & "logTest.txt"

sText = "ABC" & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")

ff = FreeFile
Open sFile For Append As #ff
Print #ff, sText
Close #ff

End Sub

I don't know what fOSUserName() is but replace the "ABC" with it.



"Melanie" wrote:

I have a protected workbook and I would like to know who has accessed the file.
Is there a way to log the user name of whoever has accessed it in a
different file?

Thanks!!