访问 VBA 重命名文件 [英] Access VBA rename a file
本文介绍了访问 VBA 重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用两个文本框在 VBA 访问中执行重命名.这是我的代码:
I trying to use two textboxes to perform a rename in VBA access. Here is my code:
Private Sub Command61_Click()
Name Me.sourFullPath As Me.destFullPath
End Sub
sourFullPath
和 destFullPath
都有完整的文件路径,包括文件夹路径和文件名+扩展名,它们都在同一个驱动器上.但是在我运行它之后,Access 给了我
Both sourFullPath
and destFullPath
have the whole file path include the folder path and the file name + extension, they all on the same drive.
But after I ran it, Access gives me
运行时错误 5:无效的过程调用或参数.
Run-time error 5: invalid procedure call or argument.
有人知道是什么原因造成的吗?
Does anyone know what causes that?
谢谢
推荐答案
语法正确,因此请检查您实际尝试执行的操作:
The syntax is correct so check what you actually are trying to do:
Private Sub Command61_Click()
Debug.Print "Source: '" & Me.sourFullPath & "' Target: '" & Me.destFullPath & "'"
Name Me.sourFullPath As Me.destFullPath
End Sub
另外,目标文件夹必须存在.
Also, the target folder must exist.
这篇关于访问 VBA 重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文