Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 我需要在VBA中重命名一个文件,但是得到;“未找到文件”;当它';很明显在那里_File_Vba_Rename - Fatal编程技术网

File 我需要在VBA中重命名一个文件,但是得到;“未找到文件”;当它';很明显在那里

File 我需要在VBA中重命名一个文件,但是得到;“未找到文件”;当它';很明显在那里,file,vba,rename,File,Vba,Rename,救命啊!尝试使用变量重命名文件时,我遇到一个文件未找到错误。变量是一个字符串 我可以查看变量,它的确切文件名在那里,但当我运行代码时,它会显示“未找到” 我对VBA一无所知,但普通语言需要转义“\”。 所以请尝试“P:\\Automated\\”等。“正常”?德尔菲很正常。您可能是指“多种语言”或“某些语言”?VBA的情况并非如此,它仍然相当正常。名称中是否有空格?你对filesystemobject有什么好处?你有权限吗?错误消息有时不是很可靠。 Dim filePath, fileName,

救命啊!尝试使用变量重命名文件时,我遇到一个
文件未找到
错误。变量是一个
字符串

我可以查看变量,它的确切文件名在那里,但当我运行代码时,它会显示“未找到”


我对VBA一无所知,但普通语言需要转义“\”。
所以请尝试“P:\\Automated\\”等。

“正常”?德尔菲很正常。您可能是指“多种语言”或“某些语言”?VBA的情况并非如此,它仍然相当正常。名称中是否有空格?你对filesystemobject有什么好处?你有权限吗?错误消息有时不是很可靠。
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