Reading a .txt file

B

brad.canney

Hey guys,

I have a ms word document that contains a table. I'm looking for a
script that will read variables from a .txt file (output from another
program) and insert them into my word document (report) I cannot seem
to find anything on the web.

Thanks
 
G

Graham Mayor

On the face of it it sounds like mail merge, but if not, you will need to
provide more information.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

Insert the variables into the .Range of the cells of the table.

[document object].Tables(n).Cell(i, j).Range.Text = [your variable]

You have not given enough information to give more specific assistance.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
B

brad.canney

Yeah I can insert the variables into the table... that was easy. But
I'm looking for a starting point to get vba to read a set of variables
line by line from a text file so I can work with them in vba. I've
never read in variables from a text file.


Insert the variables into the .Range of the cells of the table.

[document object].Tables(n).Cell(i, j).Range.Text = [your variable]

You have not given enough information to give more specific assistance.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP




Hey guys,
I have a ms word document that contains a table. I'm looking for a
script that will read variables from a .txt file (output from another
program) and insert them into my word document (report) I cannot seem
to find anything on the web.
Thanks- Hide quoted text -

- Show quoted text -
 
D

Doug Robbins - Word MVP

There is nothing particularly magic about text files. They can be opened in
Word and their contents can be accessed, but it is necessary to know how the
required information is laid out in the file to provide more specific
information. Open the file in Word and click on the Show/Hide ¶ button and
tell us what you see.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Yeah I can insert the variables into the table... that was easy. But
I'm looking for a starting point to get vba to read a set of variables
line by line from a text file so I can work with them in vba. I've
never read in variables from a text file.


Insert the variables into the .Range of the cells of the table.

[document object].Tables(n).Cell(i, j).Range.Text = [your variable]

You have not given enough information to give more specific assistance.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP




Hey guys,
I have a ms word document that contains a table. I'm looking for a
script that will read variables from a .txt file (output from another
program) and insert them into my word document (report) I cannot seem
to find anything on the web.
Thanks- Hide quoted text -

- Show quoted text -
 
R

Russ

What kind of structure are your text files going to have? Are they comma
separated values? One Value per line? Table Format? You haven't given enough
information. Can you copy and paste a good example of the text file
structure?
Yeah I can insert the variables into the table... that was easy. But
I'm looking for a starting point to get vba to read a set of variables
line by line from a text file so I can work with them in vba. I've
never read in variables from a text file.


Insert the variables into the .Range of the cells of the table.

[document object].Tables(n).Cell(i, j).Range.Text = [your variable]

You have not given enough information to give more specific assistance.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP




Hey guys,
I have a ms word document that contains a table. I'm looking for a
script that will read variables from a .txt file (output from another
program) and insert them into my word document (report) I cannot seem
to find anything on the web.
Thanks- Hide quoted text -

- Show quoted text -
 

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