I am surprised no one pointed this out
Here if your path ends in "\" your are adding another "\" to it which would make it invalidCode:If Right(GBLpathFile, 1) = "\" Then path = path & "\" & "Daftar Karyawan" & "\" & Year(Date) & "\" & UCase(Format(Date, "MMMM")) & "\" & .FileTitle
Of course I do not know what is in your path variaible so that may or may not be the problem but is surely incorrect. You need to remove the part in red.
You should also check to see what the path holds after it is built and then see if that path actually exists.
You can do this by stepping through the code and checking the value or by using a msgbox to display it or using a debug.print to display it.
Edit: After a second look I see that path is empty when it gets here so that part of the if statement would not be executed which means that is not the problem but also means it should not be there.




Reply With Quote