For this thread I would like to know once I opened a txt file instead of opening the entire contents from the file, I would like my macro to
1) Look for “Sub Pre_Shorts” and “subend”. “Sub Pre_Shorts” is the starting point and “subend” is ending point. I need to extract information data that are between these two points (I managed to do this, take a look at my attached file)
Once locate these two points, need to do the following steps:
2) Look for lines that start with “!”, if the next word is something like, test "analog/….” Or test "Digital/….” Get their information onto the spreadsheet. For e.g. if the line is
!#@ test "analog/l1" on boards BoardSet_boards_1_to_2(*)
- “!” should be column A, “#@” not needed
- “analog” in column B
- “l1” in column C
- The rest of the words in the line not needed
3) Look for lines that start with “test”, if the next word is something like, "analog/….” Or "Digital/….” Get their information onto the spreadsheet. For e.g. if the line is
test "digital/u3" on boards BoardSet_boards_1_to_2(*) !ok
- “Digital” in column B
- “u3” in column C
- The rest of the words in the line not needed
This is only extracting data for Sub Pre_Shorts. There is still few other “Sub …. “. So once the macro complete the task for “Sub Pre_Shorts”. It should look for the other “Sub …” and repeat step 2 and 3. Below is the name of the other “Sub .. “ names which need to look for,
Start Point
End Point
Sub Analog_Tests
subend
sub BScan_Powered_Shorts_Tests
subend
sub BScan_Interconnect_Tests
subend
sub BScan_Incircuit_Tests
subend
sub BScan_Silicon_Nails_Tests
subend
sub Digital_Tests
subend
sub Functional_Tests
subend
sub Analog_Functional_Tests
subend
Inside the txt file (attached) there is other names starting with “Sub..", e.g. “sub Connect_Check” those are not needed to extract, so can ignore.
Important: If one of the start point cannot be found in the txt file, the macro should ignore that start point and should continue with the other start points, (e.g. if “Sub Analog_Tests” is not in the txt file, just ignore it and continue with the rest of the start points).
Right now, I am stuck at step 2 and 3, and also not sure how to loop so that once it complete one start point it goes on with another start point.
I have attached some pictures to illustrate more clearly.
sub.jpg
sub2.jpg
spec.jpg
i have attached sample txt file
I have also attached a workbook, Sheet1 consist a button with my codes and sheet2 is what I desired output should look like
Extract.xls
testplan_mario.zip
Bookmarks