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