Hi guys,
thanks for your replies!
@ebs17
AT221111011010110011 - I think this is the IBAN (bank and account number).
yes it is.
Now you want to look at the first line of content. So the structure seems to be anything but standardized; the name of the file does not guarantee expected and immediately usable content.
The Bank Statements have for the first line of content always a certain structure.
IBAN; Auszugsnummer; Buchungsdatum; Valutadatum; Umsatzzeit; Zahlungsreferenz; Waehrung; Betrag; Buchungstext; Umsatztext
You are right that maybe if someone has modified that file in any way there could be an issue.
But it is is from the original Download so to speak than the file is in the same structure.
In the Column of Buchungsdatum I would like to find lowest Date and Highes Date, currently Code for workbookopen and looping through the Column,
As you guys mentioned that is not the savest way I was trying to do that with the InputStatement, but still working on it and not just yet able to do so.
You still have no overview or concept.
My concept was open workbook and check for the first line of content. Check for the Account which is the last five digits of the IBAN,
Check for the lowestDate and highestDate in Buchungsdatum, and the Year of that file again from either the lowest or highest Date Value in Buchungsdatum.
Build a filename according to that information and save it to "MyFiles/2023/12345/12345_01To10_2023.csv" for example.
Once that has been done.
Import the files with transferText into my Database into Table IMPORT.
ImportSpecifications for that matter have been created and are able to work once the fileName is someting like 2023_01_09_12345.csv
or 12345_2023_01_09.csv or which ever sequence it would be.
If a file has been renamed and is saves already with a different name. I would like to just view the file first and if it is valid file then do the above and save it to the right location and the right file name.
@spaLOGICng
In VBA you can use the SaveCopyAs method under the Workbook Object. Yous simply provide the the Filename that will include the folder path where you want to save it to.
This saves the Workbook/CSV as a duplicate. The current opened version is not affected in any way.
Ok that is great but again there still remains the issue of getting the fileName I like to get out of the File content of the IBAN " & "Dates
@CJ_London
I looked at the imput function
Currently just able to do the first line of content with code but not to sure how to get the dates out of it