Help to import variable file with date in file name

yes i have both the files in the folder. /nothing happens in the immediate window after hitting ?bothpaths
 
You must either have the folder path wrong, the files aren't there, or else the files are named differently than we discussed.
What are your two existing file names now?
You have to do it while the code is still in Break mode, with the yellow offending line of code highlighted..

I just tested my code again, it worked correctly. See the attached and pay close attention to the TestFunction sub and the comments.
Testing 20200702 find file_folder source.jpg


Testing 20200702 find file.jpg
 

Attachments

files are correctly named, outwardsort_260520 & onussort_260520. not sure where i am making the mistake,

thankyou for you help. since i have your testing file, i will try and replicate my project in that and try to play it tomorrow morning.
 
files are correctly named, outwardsort_260520 & onussort_260520. not sure where i am making the mistake,
I think it might be a case sensitive comparison.

Try changing
If Left(fsoFile.Name, 11) = "OutwardSort" And (Len(fsoFile.Name) = 22) Then
to
If Left(lcase(fsoFile.Name), 11) = "outwardsort" And (Len(fsoFile.Name) = 22) Then

and
If Left(fsoFile.Name, 8) = "OnusSort" And (Len(fsoFile.Name) = 19) Then
to
If Left(lcase(fsoFile.Name), 8) = "onussort" And (Len(fsoFile.Name) = 19) Then
 
@pisorsisaac@gmail.co - does your code allow for file path spaces? Maybe the OP's file path(s) has them.
Sorry, I didn't download or study the code; even then, I've not seen the problem path(s) either, but just trying to help.
 
Good thought, but when I tested mine it was with a folder with spaces in the name. Should work . I think the latest problem was with the case sensitive comparison
 
That would mean OP has set db Option Compare as "Binary" or has no setting?
(defaults to Binary if not set)
 
Yes I believe you're right. I didn't want to suggest he change it to option compare text, I figured the less "sweeping" solution would just be the lower case conversion that I recently posted. That way it doesn't mess up anything else they already have going.
I should have caught that issue earlier when I was posting my code at first but I guess I took the requirements bit too literally
 

Users who are viewing this thread

Back
Top Bottom