Searching for text and making modification

HotLanta

Board Regular
Joined
Nov 3, 2005
Messages
176
In another thread recently I had asked for help with a macro that will loop through a folder containing text files and add information from my Excel form into each text file.
I'm working on that project still and I have another question:

The software that creates the text files only exports the time as HH:MM and either AM or PM. Additionally it adds a $$ double dollar sign to the line.
Specifically in the text file it looks like this:

$$ Time: 12:15 PM

The software that I am importing the text files into 1) Cannot read lines that begin with $$ and 2) needs the time to be in HH:MM:SS format.

I should say that the second software uses HH:MM:SS as a serial number for the data.
I say that to say it really doesn't matter to me that I don't know the actual SS from the export software. I just need the SS to be unique for each file though.

My thought was, can we

Loop through a folder of text files
Look for the $$ Time: 12:15 PM
Delete the $$
Delete AM or PM
To 12:15 add :01
Loop through the text files and add 01 to each time?

Maybe it will look like this:

12:15:01
12:15:02
12:15:03
12:16:01
12:16:02
12:17:01

Another option - could we look for $$ Time: 12:15 PM, delete that line, and replace it with the =NOW() computer time in HH:MM:SS format?

Thank you
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top