Insert text from a text file into Word doc 
Author Message
 Insert text from a text file into Word doc

Hi all,

I am creating an application in which a user selects from a range of options
on a form.  Based on the selections made, text strings in a whole bunch of
separate text files are combined to form the body of the document (a medical
report).  My question is this: what is the best way of retrieving the text
from the text files?  Apart from actually opening the text file, what other
options do I have?

Thanks in advance,

Paul Hobbs



Fri, 19 Sep 2003 05:38:42 GMT  
 Insert text from a text file into Word doc


Quote:
> report).  My question is this: what is the best way of
retrieving the text
> from the text files?  Apart from actually opening the text file,
what other
> options do I have?

There is the field  "IncludeText". It makes a reference to all or
a part of a document.

Greetings
Mads Knudsen



Fri, 19 Sep 2003 14:19:29 GMT  
 Insert text from a text file into Word doc
Hi Mads,

Thanks for your suggestion, but I neglected to mention that I had hoped for
a VBA solution.

Cheers,

Paul Hobbs


Quote:



> > report).  My question is this: what is the best way of
> retrieving the text
> > from the text files?  Apart from actually opening the text file,
> what other
> > options do I have?

> There is the field  "IncludeText". It makes a reference to all or
> a part of a document.

> Greetings
> Mads Knudsen



Fri, 19 Sep 2003 19:54:10 GMT  
 Insert text from a text file into Word doc


Quote:
> Hi Mads,

> Thanks for your suggestion, but I neglected to mention that I
had hoped for
> a VBA solution.

Since I don't know how your form works it is difficult make a
complete solution.
A INCLUDETEXT field can be inserted with the following line

    Selection.Fields.Add Range:=Selection.Range,
Type:=wdFieldIncludeText, _
            Text:="c:\\medical texts\\text1.txt",
PreserveFormatting:=False

It is important to remember the double slashes in the path to the
file to be inserted.

Greetings
Mads Knudsen



Sun, 21 Sep 2003 14:36:13 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. BuiltInDocumentProperties from non-Word text files + testing if a DOC file is a Word file

2. Inserting text in Word doc with VBA

3. Write text and insert pic to Word doc (from Access VBA)

4. Replacing Text in Text Boxes in Word Doc from VB

5. Saving a Word Doc with text from file

6. Converting .doc Files to Text in Word XP Fails

7. opening a word (.doc) and Text (.txt) file

8. Finding text inside Word doc without Word?

9. inserting text into certain part of text file

10. Inserting text from a text file into a textbox

11. Inserting text in text files

12. HW: Execute MS Word from VB5 and insert text into Word

 

 
Powered by phpBB® Forum Software