View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default INCLUDETEXT field problem witht Word 2007

However I had to update manually the field (with F9) to update the
field and make the text appear after having oppened the word file.


This has been standard behaviour in Word for quite a long time - it's a
"security feature"

\pard\ql{\field{\*\fldinst { INCLUDETEXT "C:/data/MyText.txt" \\! \\*
MERGEFORMAT }}}


I am not sure about the use of the switches ... \\! \\* MERGEFORMAT


I would certainly get rid of the \\! (which would lock the result) and
probably the \\* MERGEFORMAT

It's just possible that Word 2007 requires one or both of the \fldedit
and \fldrslt keywords, but I doubt it

You may also need to replace the "/" characters by "\\\\" (double
because \ is the escape character for \ in rtf, and doubled again
because you need double-backslashes in pathname literals in the field
code iin Word itself, i.e.

\pard\ql{\field{\fldedit{\*\fldinst{ INCLUDETEXT
"C:\\\\data\\\\MyText.txt" }}}

See how that goes...

Peter Jamieson

http://tips.pjmsn.me.uk

wrote:
Hello,

I manage to include text from a text file in my word document with the
following RTF field statement.
However I had to update manually the field (with F9) to update the
field and make the text appear after having oppened the word file.
I was using Word 2003 and everything was fine, but when switching to
word 2007, the text was not loaded anymore even after a field update
(still with F9)...

---------------------------------------------------
\pard\ql{\field{\*\fldinst { INCLUDETEXT "C:/data/MyText.txt" \\! \\*
MERGEFORMAT }}}
---------------------------------------------------

I am not sure about the use of the switches ... \\! \\* MERGEFORMAT

any ideas ?

Thanks,

PB