I need to rename a file in VBA, but getting "File Not Found" when it's clearly there!
Posted
by Karl
on Stack Overflow
See other posts from Stack Overflow
or by Karl
Published on 2010-05-26T19:58:53Z
Indexed on
2010/05/26
20:01 UTC
Read the original article
Hit count: 209
Help! I'm getting a File Not Found error when trying to rename a file w/a variable. The variable is string. I can look at the variable and it's the exact filename that is there, but when I run the code, it says not found!
Dim filePath, fileName, absPath, newPath As String
filePath = "P:\Automated\"
fileName = MySite.GetResult
absPath = filePath & fileName
newPath = "P:\Automated\NEW.csv"
'The following is a rename from CuteFTP Pro COM Object:
'(Getting the same result from this and the below "Name".
'MySite.LocalRename "P:\Automated\" & fileName, "P:\Automated\NEW.csv"
Name absPath As newPath
© Stack Overflow or respective owner