Code:
Sub saveFile()
Dim newFile As String, fName As String
fName = "test"
newFile = fName & " " & Format$(Date, "yyyy-mm-dd")
ChDir _
"C:\Users\Tin\Desktop\"
ActiveWorkbook.SaveAs Filename:=newFile
End Sub
But if I don't use ChDir _
It is fine.
If I use ChDir _
even the location path is correct
the file will be saved in my Document Folder
Why?
Code:
Sub saveFile()
Dim newFile As String, fName As String
fName = "test"
newFile = fName & " " & Format$(Date, "yyyy-mm-dd")
ActiveWorkbook.SaveAs "C:\Users\Tin\Desktop\" & newFile
End Sub