Code to read and convert txt file

M

Matthew Schwarz

I use txt files to make news pages on my web site. The first line is the
title. The second line is the author. The third line is the date. The fourth
line through the end is the body of the story.

I'd like to be able to convert these text files into an htm template I have
with some htm code before the news story, a certain font style for the each
of the first line, the second line, the third line and remaining lines, and
then code after the story.

I've search high and low looking for a txt to htm converter and some are
promising though none can do exactly what I need.

Does anyone know one that can do this?

How about some visual basic code to run a macro within Frontpage? Basically
it would have to detect each line separated by a carriage return.

Thank you very much.
Matt
 
M

Matthew Schwarz

Hello,
Just wondering if anyone had any thoughts on this.

Basically, the best way I could imagine this is I open up a txt file from
within Frontpage, run a macro that does the following:

- Add header html code
- Take first line until first carriage return and put such and such tags
around it
- Take next line until next carriage return and put other tags
- Take next line until next carriage return and put other tages
- Take remaining text with a certain font styling
- Add footer html code

Does anyone have any ideas on how to implement something like this in VBA?
Or maybe someone can point me in the direction of a web site or an add-in
that does something similiar?
Thank you very much.
 
S

Stefan B Rusynko

In FP VBA help search for OpenTextFile Method and OpenAsTextStream Method then use the ReadLine for each line of the text file

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Hello,
| Just wondering if anyone had any thoughts on this.
|
| Basically, the best way I could imagine this is I open up a txt file from
| within Frontpage, run a macro that does the following:
|
| - Add header html code
| - Take first line until first carriage return and put such and such tags
| around it
| - Take next line until next carriage return and put other tags
| - Take next line until next carriage return and put other tages
| - Take remaining text with a certain font styling
| - Add footer html code
|
| Does anyone have any ideas on how to implement something like this in VBA?
| Or maybe someone can point me in the direction of a web site or an add-in
| that does something similiar?
| Thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top