Reputation: 25601
I'm using Access 2010, and here is screenshot from my reference libraries and avalible FileSystemObject methods from within Access VB IDE:
When I initiate this object I can't seem to be able to access familiar methods, as I get exception with this example debug result:
I also used explicit declarations and initialized variables to get same results.
Any ideas what may be wrong?
To replay on @4dmonster comment, this is the actual array:
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", ";")
Upvotes: 3
Views: 14613
Reputation: 123474
The problem here is that GetFolder()
is being passed a string containing the full path to a file and it is rightfully complaining that such a folder does not exist. If you want to extract the folder in which a particular file resides then you could use something like
fso.GetFile("C:\Users\Public\Database1.accdb").ParentFolder
Upvotes: 4