Hi from Bulgaria,
Please HELP
I'm new in VBA and I need macro that will rename txt files.
What I have is text files stored in a folder, let's say:
D\AIR\:
Each file is named as follows
AIR_2054.TXT
AIR_2055.TXT
AIR_2056.TXT ect...
What I need is macro that will read specific line form D\AIR\:"AIR_*.TXT" files and rename it ,depends on it contents
The Text files are different type , let's say 5 type
TYPE 1 check only in line 2 - /most common /
if mid(line2,13,5)="AGENT" then rename file as BIR_2054.TXT /change first string of file name from A to B/
[B]
[B]TYPE 2 check only in line 3
if mid(line3,2,3)="EMD" then rename file as EIR_2055.TXT /change first string of file name from A to E/
TYPE 3 check only in line 2
if mid(line2,18,3)="MCO"then rename file as MIR_2055.TXT /change first string of file name from A to M/
TYPE 4 check only in line 1
if mid(line1,1,16)="AUTOMATED REFUND"then rename file as RIR_2055.TXT /change first string of file name from A to R/
TYPE 5 -
NOTHING MATCH TO TYPE 1,2,3,4 THEN rename file as xIR_2055.TXT /change first string of file name from A to x/
Notes
*If one of the file contain data of ONE TYPE it is not possible to contain other TYPES*
*Some of the types start from 2-nd line /first line is blank/
I hope that you understand me:-)
Thanks in advance
Teodora
Bookmarks