Manipulating text files in vba

JetEscamilla

Board Regular
Joined
Apr 17, 2006
Messages
91
Office Version
  1. 2016
Platform
  1. Windows
I have some large text output from a structural analysis program (MDX) and I am trying to get a comparison between that and some other calculations that were done by hand.

The text file is very large and all the data in the text file is not user friendly. Instead of all design forces being in a nice text block I can copy and paste into excel I am going to have to manually search for the design members I need and then pull the data. I would like to create a macro to do this for me. Is this possible in vba?

I have used vba to do some complex data manipulation internally in excel, but never with text files.

Thanks.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
So...

There is string of text "Service Axial Forces - k" that is always in front of the data I want. I would like to seach for it and then when I find it "pull in" the next 14 lines of text. Then repeat until the text is done searching. I can seperate the text after with delineators, but if I can somehow do that in vba, even better.
 
Upvote 0
Use the Open and Line Input statements to read the file line by line and the Instr function to search for the string.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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