i would like the code below to save to a particular location instead of in the same directory as the file. also i would like to log if the user saved the file and what time along with opening it and closing like the code currently does. thanks in advance for your help.
Code
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"_
(ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Sub Auto_Open()
Dim FNum As Integer
Dim UL As Long
Dim UName As String
Dim CL As Long
Dim CName As String
FNum = FreeFile
Open ThisWorkbook.Path & "\log.txt" For Append As #FNum
UName = String$(255, 0)
UL = 255
CName = String$(255, 0)
CL = 255
GetUserName UName, UL
GetComputerName CName, CL
Print #FNum, ThisWorkbook.FullName & " OPENED at " & _
Format(Now, "dd-mmm-yyyy hh:mm:ss") & " by user: " & _
Left(UName, UL) & " from computer: " & Left(CName, CL)
Close #FNum
End Sub
Display More