I made this macro to create folders and subfolders automatically, but I need to save the file I'm editing inside the created pasture ... can anyone help me?
Follow the script
' MACRO PARA CRIAR PASTA DE ANO/MES/DIA
Public Const sCaminho = ""
Dim Pasta As New FileSystemObject
Public Function fnccriardiretorio(data As Date)
If Pasta.FolderExists(sCaminho & "\" & Format(data, "yyyy")) Then
fncmes (data)
Else
Pasta.CreateFolder (sCaminho & "\" & Format(data, "yyyy"))
fncmes (data)
End If
End Function
Public Function fncmes(data As Date)
If Pasta.FolderExists(sCaminho & "\" & Format(data, "yyyy") & _
"\" & Format(data, "mmmm")) Then
Call fncdia(data)
Else
Pasta.CreateFolder (sCaminho & "\" & Format(data, "yyyy") & _
"\" & Format(data, "mmmm"))
Call fncdia(data)
End If
End Function
Public Function fncdia(data As Date)
If Pasta.FolderExists(sCaminho & "\" & Format(data, "yyyy") & _
"\" & Format(data, "mmmm") & "\" & Format(data, "dd")) Then
Else
Pasta.CreateFolder (sCaminho & "\" & Format(data, "yyyy") & _
"\" & Format(data, "mmmm")) & "\" & Format(data, "dd")
End If
End Function
Sub chamafuncao()
Dim data As Date
data = InputBox("Entre com a Data _EX DD/MM/AAAA")
Call fnccriardiretorio(data)
End Sub