Hi,
I wanted to see if someone could help with this project. I have many text files that I am always manually editing.
I would like to have a macro that will loop through a folder on the desktop named "Text Files".
In the folder will be any number of text files. (.txt)
I want the code to find a certain piece of information and then use that to replace another piece of information.
Then save the file and loop through the rest.
The text files look like this:
FILNAM/'SAMPLE TEST PROTOTYPE'
DATE =2022/10/14
TIME =11:00:43
PR(1)='98765432'
LI(2)='EFG'
PL(3)='TUVWXY'
PN(4)='COMPANY'
PS(5)='12345678-001'
Q(6)='ABCD'
I would like for the PS(5) line to be found and then the first 8 characters copied that are in single quotes.
Then find the FILENAM/ line and replace whatever is between the single quotes with what is copied in the clipboard.
So the final result will look like this:
FILNAM/'12345678'
DATE =2022/10/14
TIME =11:00:43
PR(1)='98765432'
LI(2)='EFG'
PL(3)='TUVWXY'
PN(4)='COMPANY'
PS(5)='12345678-001'
Q(6)='ABCD'
Then loop through the rest.
Is this possible?
I wanted to see if someone could help with this project. I have many text files that I am always manually editing.
I would like to have a macro that will loop through a folder on the desktop named "Text Files".
In the folder will be any number of text files. (.txt)
I want the code to find a certain piece of information and then use that to replace another piece of information.
Then save the file and loop through the rest.
The text files look like this:
FILNAM/'SAMPLE TEST PROTOTYPE'
DATE =2022/10/14
TIME =11:00:43
PR(1)='98765432'
LI(2)='EFG'
PL(3)='TUVWXY'
PN(4)='COMPANY'
PS(5)='12345678-001'
Q(6)='ABCD'
I would like for the PS(5) line to be found and then the first 8 characters copied that are in single quotes.
Then find the FILENAM/ line and replace whatever is between the single quotes with what is copied in the clipboard.
So the final result will look like this:
FILNAM/'12345678'
DATE =2022/10/14
TIME =11:00:43
PR(1)='98765432'
LI(2)='EFG'
PL(3)='TUVWXY'
PN(4)='COMPANY'
PS(5)='12345678-001'
Q(6)='ABCD'
Then loop through the rest.
Is this possible?