如何使用VBA复制和重命名名称为中文的文件

问题描述 投票:0回答:1

我在表中具有存储在MS Access中的文件的路径。该表用于重命名一组特定的文件,因此重要的字段是oldpath和newpath。这些在VBA中使用。首先,我将数据设置为记录集。之后,我做了一段时间不使用RenameFileOrDir函数处理所有旧路径。该功能适用​​于所有非中文文件名,中文文件也没有重命名。请对此提供帮助。

Public Function TestNameStatement() 
Dim fOK As Boolean

Set rs_images = CurrentDb.OpenRecordset("Select import_acc.* from import_acc") 
rs_images.MoveLast 
rs_images.MoveFirst

Do While Not rs_images.EOF

oldlocation = rs_images.Fields("oldpath") 
newlocation = rs_images.Fields("newpath")

' Folders must exist for Source, but do not need to exist for destination 
fOK = RenameFileOrDir("" & oldlocationx & "", "" & newlocationx & "")

rs_images.MoveNext Loop 
On Error Resume Next

End Function

Access table

access-vba character cjk
1个回答
0
投票

访问选项,语言,添加中文

© www.soinside.com 2019 - 2024. All rights reserved.