
Public datOrasalva As Date
Public strNome As String
Public datOra As Date
Public datData As Date
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'variabile da valorizzare
nomepercorso = "\CLUSTERFSShareKommerzLAVORI COMMERCIALElognew.txt"
If Dir(nomepercorso, vbNormal) = "" Then
Open nomepercorso For Output As #1
Print #1, "Data accesso", "|", "Ora Accesso", "|", "Nome", "|", "PC Utente", "|", "Data e Ora Salvataggio"
Close #1
End If
Open nomepercorso For Append As #1
Print #1, datData, "|", datOra, "|", strNome, "|", Application.UserName, "|", datOrasalva
Close #1
End Sub
Sub Workbook_Open()
Do
strNome = InputBox("Qual'è il tuo nome?" & vbNewLine & "Digitare 'Esci' per chiudere il file.", "Registrazione utente")
datData = Date
datOra = Time
datOrasalva = FileDateTime("\CLUSTERFSShareKommerzLAVORI COMMERCIALElog.txt")
If StrConv(strNome, 1) = "ESCI" Then
ActiveWorkbook.Save
ActiveWindow.Close
End If
Loop While strNome = ""
End Sub |
Public datOrasalva As Date
Public strNome As String
Public datOra As Date
Public datData As Date
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'variabile da valorizzare
nomepercorso = "\CLUSTERFSShareKommerzLAVORI COMMERCIALElognew.txt"
If Dir(nomepercorso, vbNormal) = "" Then
Open nomepercorso For Output As #1
Print #1, "Data accesso", "|", "Ora Accesso", "|", "Nome", "|", "PC Utente", "|", "Data e Ora Salvataggio"
Close #1
End If
Open nomepercorso For Append As #1
Print #1, datData, "|", datOra, "|", strNome, "|", Application.UserName, "|", now
Close #1
End Sub
Sub Workbook_Open()
Do
strNome = InputBox("Qual'è il tuo nome?" & vbNewLine & "Digitare 'Esci' per chiudere il file.", "Registrazione utente")
datData = Date
datOra = Time
If StrConv(strNome, 1) = "ESCI" Then
ActiveWorkbook.Save
ActiveWindow.Close
End If
Loop While strNome = ""
End Sub |
