Try this......
Dim mylog As New FileSystemObject
Dim createlog As TextStream
Private Sub CommandButton1_Click()
createlog.WriteLine ("Command Button1 click " & Date & " " & Time)
End Sub
Private Sub UserForm_Initialize()
If mylog.FileExists("C:\mylog.log") = False Then
Set createlog = mylog.CreateTextFile("C:\mylog.log", False)
Else
Set createlog = mylog.OpenTextFile("C:\mylog.log", ForAppending, False, TristateUseDefault)
End If
End Sub




