
Private Sub Workbook_Open()
'
'richiamare macro
'
Call mBackUp
Call CLOCK
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'
'salvare file rinominadolo secondo cella e data-ore-minuti.seconti
'
Dim sh As Worksheet
Dim strPath As String
Dim strOldFile As String
Application.DisplayAlerts = False
With Me
Set sh = .Worksheets("Revisioni")
strPath = .Path & ""
strOldFile = .FullName
.SaveAs strPath & sh.Range("B2") & " " _
& Format(sh.Range("D2"), "dd-mm-yyyy_hhmmss"), 52 '56
If Not .FullName = strOldFile Then Kill strOldFile
End With
Application.DisplayAlerts = True
Set sh = Nothing
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim lReply As Long
If SaveAsUI = True Then
lReply = MsgBox("Non sei autorizzato a salvare con altro nome.Clicca sul pulsante Salva e Chudi", vbQuestion + vbOKCancel)
Cancel = (lReply = vbCancel)
If Cancel = False Then Me.Save
Cancel = True
End If
End Sub |
Sub salva()
Set wb = ActiveWorkbook
nomefile = Worksheets("Revisioni").Range("E2").Value
ChDir "C:ExcelBackup"
wb.SaveAs Filename:=nomefile & Format(Now, "_yyyy-mm-dd_hh.mm.ss") & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, Password:="titaniimmortali", WriteResPassword:="TitaniImmortali", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
|
Private Sub Workbook_Open()
'
'richiamare macro
'
Call mBackUp
Call CLOCK
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'
'salvare file rinominadolo secondo cella e data-ore-minuti.seconti
'
Dim sh As Worksheet
Dim strPath As String
Dim strOldFile As String
Application.DisplayAlerts = False
With Me
Set sh = .Worksheets("Revisioni")
strPath = .Path & ""
strOldFile = .FullName
.SaveAs strPath & sh.Range("B2") & " " _
& Format(sh.Range("D2"), "dd-mm-yyyy_hhmmss"), 52 '56
If Not .FullName = strOldFile Then Kill strOldFile
End With
Application.DisplayAlerts = True
Set sh = Nothing
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim lReply As Long
If SaveAsUI = True Then
lReply = MsgBox("Non sei autorizzato a salvare con altro nome.Clicca sul pulsante Salva e Chudi", vbQuestion + vbOKCancel)
Cancel = (lReply = vbCancel)
If Cancel = False Then Me.Save
Cancel = True
End If
End Sub |
