Option Explicit
Sub Test()
LogRun "Test"
End Sub
Sub LogRun(MacroName As String)
Const TristateTrue As Long = -1
Const ForAppending As Long = 8
Const sMSScriptingRuntime_c As String = "Scripting.FileSystemObject"
Const sLogPath_c As String = "C:\Test\maclog.txt"
Const sUserName_c As String = "USERNAME"
Const sComputerName_c As String = "COMPUTERNAME"
Dim oFSO As Object
Dim oTS As Object
Set oFSO = VBA.CreateObject(sMSScriptingRuntime_c)
Set oTS = oFSO.OpenTextFile(sLogPath_c, ForAppending, True, TristateTrue)
oTS.WriteLine VBA.Now & vbTab & MacroName & vbTab & VBA.Environ$(sUserName_c) & vbTab & VBA.Environ$(sComputerName_c)
oTS.Close
End Sub