gpt4 book ai didi

ms-access - 在 Access VBA 中使用文件系统对象

转载 作者:行者123 更新时间:2023-12-04 02:43:04 25 4
gpt4 key购买 nike

我使用的是 Access 2010,这里是我的引用库和 Access VB IDE 中可用的 FileSystemObject 方法的屏幕截图:

enter image description here


当我启动这个对象时,我似乎无法 Access 熟悉的方法,因为我在这个示例调试结果中遇到异常:

enter image description here


我还使用显式声明和初始化变量来获得相同的结果。

有什么想法可能是错误的吗?


重播@4dmonster 评论,这是实际的数组:

For Each p In Split("f:\temp\test\op1\gev_final_1.xlsx;f:\temp\test\op1\gev_final_2.xlsx;f:\temp\test\op1\gev_final_3.xlsx;f:\temp\test\op1\gev_final_4.xlsx;" & _
"f:\temp\test\op1\gev_final_5.xlsx;f:\temp\test\op1\gev_final_6.xlsx;f:\temp\test\op1\gev_final_7.xlsx;f:\temp\test\op2\gev_final_8.xlsx;" & _
"f:\temp\test\op2\gev_final_9.xlsx;f:\temp\test\op2\gev_final_10.xlsx;f:\temp\test\op2\gev_final_11.xlsx;f:\temp\test\op2\gev_final_12.xlsx;" & _
"f:\temp\test\op2\gev_final_13.xlsx;f:\temp\test\op3\gev_final_14.xlsx;f:\temp\test\op3\gev_final_15.xlsx;f:\temp\test\op3\gev_final_16.xlsx;" & _
"f:\temp\test\op3\gev_final_17.xlsx;f:\temp\test\op3\gev_final_18.xlsx;f:\temp\test\op3\gev_final_19.xlsx;f:\temp\test\op4\gev_final_20.xlsx;" & _
"f:\temp\test\op4\gev_final_21.xlsx;f:\temp\test\op4\gev_final_22.xlsx;f:\temp\test\op4\gev_final_23.xlsx;f:\temp\test\op4\gev_final_24.xlsx;" & _
"f:\temp\test\op5\gev_final_25.xlsx;f:\temp\test\op5\gev_final_26.xlsx;f:\temp\test\op5\gev_final_27.xlsx", ";")

最佳答案

这里的问题是 GetFolder() 正在传递一个包含文件 完整路径的字符串,它理所当然地提示这样一个文件夹 不存在。如果你想提取特定文件所在的文件夹,那么你可以使用类似

的东西
fso.GetFile("C:\Users\Public\Database1.accdb").ParentFolder

关于ms-access - 在 Access VBA 中使用文件系统对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19479508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com