Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much! It is much appreciated!
"john" wrote in message ... robert, you could create a logfile using notepad application. See if following is of any help: '***********Standard MODULE(S)*********** Option Explicit Public Function LogUserData(LogUser As String) Dim FilePath As String Dim FolderName As String Dim FileName As String On Error GoTo MakeFolder AddData: With ThisWorkbook FilePath = .Path FileName = Left(.Name, Len(.Name) - 4) End With FolderName = "UserLog" Open FilePath & "\" & FileName & _ " UserLog.Log" For Append As #1 Print #1, LogUser Close #1 Exit Function MakeFolder: MsgBox (Error(Err)) 'folder missing so create it MkDir ThisWorkbook.Path & "\UserLog" Resume AddData End Function Sub atest() LogUserData "Tested by " & Application.UserName & _ " " & Format(Now, "dd mmm yyyy hh:mm:ss") End Sub Sub OpenNotepad() Dim FileToOpen As Variant FileToOpen = Application _ .GetOpenFilename("Text Files (*.log), *.log", Title:="Open UserLog File") If FileToOpen < False Then Shell "notepad.exe " & FileToOpen, vbNormalFocus End If End Sub '*****THISWORKBOOK MODULE**** Private Sub Workbook_Open() LogUserData "Opened by " & Application.UserName & _ " " & Format(Now, "dd mmm yyyy hh:mm:ss") End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) LogUserData "Saved by " & Application.UserName & _ " " & Format(Now, "dd mmm yyyy hh:mm:ss") End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) LogUserData "Closed by " & Application.UserName & _ " " & Format(Now, "dd mmm yyyy hh:mm:ss") End Sub -- jb |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to determine row of page break on modified presentation sheet? | Excel Discussion (Misc queries) | |||
Excel File Open Box - want Date Modified | Excel Discussion (Misc queries) | |||
Determine if cell was modified by Enter , Paste or Delete | Excel Programming | |||
How to determine which button was clicked on the modified right-click menu | Excel Programming | |||
Excel changes file modified date when opening my add-in | Excel Programming |