Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I have this code...
mntxt = "August"
distpath = "D:/wsop 2020/Distributables/"
strFile = "D:/wsop 2020/Distributables/August"
subpath2 = "06 THU"
I use a function (FileExists) to check if this path exists, and if it doesn't, then create it. 'distpath' always exists, but if the month folder doesn't exist in it, then create the month (mntxt) folder.
Problem 1:
When 'August" exists in 'distpath', the FileExists function comes back = false and proceeds to create the folder "August" as if it didn't exist. The line in red results in a "Path/File access error." Looking for help in what is causing this error. Is it because the path exists already? If so, what would be causing the function to report the path being nonexistent when it truly exists. If the function returned true, it wouldn't try to recreate the folder.
Problem 2:
I am trying to add a new folder (subpath2) to the month folder. What I have in blue isn't the right approach. Can someone share how to create a new folder in an existing folder?
Rich (BB code):
strFile = distpath & mntxt
If FileExists(strFile) = False Then
MkDir strFile
End If
subpath2 = Format(Day(inq_date), "00") & " " & UCase(daytext)
MkDir subpath1 & subpath2
mntxt = "August"
distpath = "D:/wsop 2020/Distributables/"
strFile = "D:/wsop 2020/Distributables/August"
subpath2 = "06 THU"
I use a function (FileExists) to check if this path exists, and if it doesn't, then create it. 'distpath' always exists, but if the month folder doesn't exist in it, then create the month (mntxt) folder.
Problem 1:
When 'August" exists in 'distpath', the FileExists function comes back = false and proceeds to create the folder "August" as if it didn't exist. The line in red results in a "Path/File access error." Looking for help in what is causing this error. Is it because the path exists already? If so, what would be causing the function to report the path being nonexistent when it truly exists. If the function returned true, it wouldn't try to recreate the folder.
Problem 2:
I am trying to add a new folder (subpath2) to the month folder. What I have in blue isn't the right approach. Can someone share how to create a new folder in an existing folder?