Hello Arkadi,
Thanks for your solution but it doesnīt work for me. Kindly see an attachement, it does not dissapear when I hit Yes, No even Cancel
Had to force quit via task manager.
aaa.png
My current code is below
Select Code copy to clipboard
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
Dim WbName As String
Dim WbExtension As String
Dim WbNewPath As String
Dim sHostName As String
sHostName = Environ$("computername")
If DestinationFolder = "" Or Dir(DestinationFolder, vbDirectory) = vbNullString Then
MsgBox "The destination folder's path is incorect!", vbCritical, "Wrong folder's path"
Exit Sub
End If
WbName = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1))
WbExtension = Right$(ThisWorkbook.Name, Len(ThisWorkbook.Name) - InStrRev(ThisWorkbook.Name, "."))
WbNewPath = DestinationFolder & "\" & "(" & Format(Now(), "dd.mm.yyyy - hh.mm") & ")" & sHostName & "." & WbExtension
ThisWorkbook.SaveAs WbNewPath, Password:="test"
End Sub
Bookmarks