Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract text and save as new file

Status
Not open for further replies.

SMHSleepy

Technical User
Sep 8, 2009
174
0
0
CA
Hello all,

Just a shot in the dark here but is there a way to read a rtf file, extract just the first 5 lines of text (or the last 5 lines, whichever is easier) and save it as a txt file?

For example, my rtf file begins with:
INDEX FILE
0123456
28/02/2011
REPORT NAME
FILE_NAME.RTF
.....
.....

I need to create a txt file containing just these 5 lines. Currently, I have to manually copy and paste these into a new txt file but I'd like to be able to automate the process using VBA code. Any suggestions?
 
If you haven't already done so, post this in the VBA forum. You will receive a much better answer.

Add water (makes its own sauce).
 
Thanks for the suggestion but I already figured it out. Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top