I have a folder where I keep data that needs to be updated daily. In order not to lose the history I copy this folder and paste it in another place. But after copying and pasting the folder, I need to rename it with the current date so I do not have folders with the same name.
Sub faz_backup()
Dim newName As String
CopiarArq "C:\Users\leandro.lazari\Desktop\Dados MegaWhat\Dados",
"C:\Users\leandro.lazari\Desktop\Dados MegaWhat\Histórico"
Data = DateSerial(Year(Now), Month(Now), Day(Now))
newName = "C:\Users\leandro.lazari\Desktop\Dados MegaWhat\Histórico\Dados"
Name "C:\Users\leandro.lazari\Desktop\Dados MegaWhat\Histórico\Dados"
As newName & Data
End Sub
I did it this way. The code copies and pastes the folder, but an error appears saying that the file was not found. However, the address is correct