Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    INCLUDE FIELDS (WORD2000)

    I am having a problem when using the INCLUDETEXT field. This forces a carriage return which I don't want.
    Originally I was using a file with the text which I thought was forcing the C/R but have since included that into another doc, bookmarked it and included that in an other doc.

    Is there anyway to prevent this C/R.
    <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

  2. #2
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    I've had similar problems where unwanted C/R appear in text using the INCLUDETEXT field. (often in conjunction with an IF field)

    I have always been able solve the problem by carefully bookmarking the text without the Paragraph Mark. I've also found using paragraph spacing before or after an INCLUDETEXT field can help resolve inconsistant spacing between paragraphs.

    I hope this helps.

    Matthew

  3. #3
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Hi Matthew,

    I have tried your suggestion with little success. Let me explain.
    I have a textfile generated through a Batch (DOS) script. This file contain a single line of text e.g. "My House"

    Originally I tried to include this straight into my working doc (DOC1) but found that it put this C/R in.
    I then thought along your lines of including it into another doc (DOC2) a master doc and bookmarking it.
    However two problems arose
    1 - If in DOC1 I reference the bookmark from DOC2, the DOC1 INCLUDE "Filename" changes to reference the txt doc as soon as I try to update [F9] it. Rather than referncing DOC2!! (A word smartie maybe)
    2 - If I try to select just the word in DOC2 without the para. markers I can't do it. I can select any part of the word except that as soon as I select the first letter of the first word, "Word" automatically selects the entire textline including the C/R. I have tried this in every concievable selection method I can think of including using Shift & Cursors keys.

    So I think I am stuck between a rock and a granite wall and have opted to reword the letters so that the next word after my include is a new para. which works, but then I am a "professional" and hate taking the easy way out and also not finding a solution. <img src=/S/disappointed.gif border=0 alt=disappointed width=15 height=15>

    Thanks for your help anyway.

  4. #4
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Peter,

    This seems odd. I've never had problems bookmarking text without the Paragragh mark (with formatting marks visible) [Tools - Options - View tab]
    Would it be possible for you to send a sample file so that I can "have a play"?

    Regards,

    Matthew

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: INCLUDE FIELDS (WORD2000)

    You might want to consider alternative ways to automate this. For example, you can use VBA to read a text file and populate bookmarks, document variables, or document properties.

  6. #6
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Some more background info.
    DOC2 is a (static) Master DOC and is used as a resource and never opened by the user. This has the INCLUDETEXT ref to the txt file but does not work correctly as there is no Forced Update to this DOC. As it is never opened any change to the referenced txt file is not felected in the field. DOC2 does not know about it (until someone opens it and hits the F9 key, but this is never done).

    So, I have now tried putting a "hidden" include field in DOC2 but again this does not get Force Updated so even though the DOC is opened and the fields ref. the hidden one I cannot get the hidden one to update. DOC1 is part of a mailmerge run which is generated from a ThirdParty application and again the user has no access to the source doc, only the "mailmerge copies" of DOC1.

    So I have got around the wierdo bookmark part of it by adding a space in front of the data written to the text file. I now have the issue of setting the bookmark where it will get updated automatically.


    If it helps the docs and txt file are attached in a zip file. Appreciate your help in advance.
    Attached Files Attached Files

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Uh-oh, merges are not my strong suit. Would it possible to use a bit of code the write to venue string into your main merge document before merging, instead of trying to get it from an external file using INCLUDETEXT? I mean, it's possible to change a document this way, but given your workflow, is there an intermediate point at which you could pause and make changes to the main merge document? It might be as simple as creating a custom document property called Venue and using { DOCPROPERTY } fields in the letter so that you just need to fill in the property before merging. (This is an untested theory!)

  8. #8
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Whilst this is stepping outside my knowledge zone I am happy to try other options. However maybe I should remove the confusion from this and say what I actually want to do (7 posts too late maybe).

    I have a document which I want to include the "VenueName". This is referenced directly from a text file using the standard INCLUDETEXT field(not via a bookmarked field MASTER DOC). This works as expected, except it puts a carriage return as part of the field forcing any continuing letter text down to the next line. End of problem.

    (I think the easiest way out of this is to re-word the letters to allow for the CR.)
    Thanks to all for your input. <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    I would think that Matthews suggestion should work. You don't need a master document as an intermediary. The problem that you've mentioned when updating the document is solved with a ! switch. That will prevent a field from updating in your destination document...it will always reflect the source document. The syntax is:

    {INCLUDETEXT "DriveFolderfilename.doc" !}

    Cheers,

  10. #10
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    The problem seems to stem from the fact that redirected output from a batch file adds a CR/LF to the end of the "line". I've confirmed this in a hex editor, and can't find a way around it.

    Given that as a constraint, and Jefferson's idea of utilising a custom document property (he's usually right <img src=/S/grin.gif border=0 alt=grin width=15 height=15> ) the attached macro (or a variation of it) will manage to read the first line of text from your generated text file, up to but not including the CR/LF, and store it in the custom document property "Venue". This property can then be referenced in the document as an updatable (and unlinkable) field:

    ... and { DOCPROPERTY "Venue" } is the venue for the event.

    How exactly you use it will depend on how you intend to do updates, new docs etc. As it stands, it will delete any existing "Venue" property and look for a new value from the file specified, but this behaviour can be modified as needed. It's really just a start, to show that it is "doable".

    Sub SetVenueProperty()
    '
    ' Use this Macro in Autonew() and/or AutoOpen()
    ' as required
    '

    Dim fs, f, ts, VenueName As String

    ' Read the first line of text, excluding CR/LF into the
    ' variable VenueName (specify appropriate file name/path)
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile("c:windowsdesktopvenue.txt")
    Set ts = f.OpenAsTextStream(1, -2)
    VenueName = ts.ReadLine
    ts.Close

    On Error Resume Next
    ActiveDocument.CustomDocumentProperties("Venue").D elete
    ActiveDocument.CustomDocumentProperties.Add _
    Name:="Venue", LinkToContent:=False, Value:=VenueName, _
    Type:=msoPropertyTypeString

    ' Optional messagebox output
    MsgBox ActiveDocument.CustomDocumentProperties("Venue").V alue


    End Sub

    --
    Alan

  11. #11
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    You are right it does force an update.
    However if I use this I still have the C/R problem.
    If I reference just the text I need in a hidden field, it doesn't work because as soon as the doc updates the hidden field it deletes the bookmark and consequently I get an error in the REF field Error! Source not found...

    As for the VB scripts, I am reluctant as I don't want to make this doc complicated (a personal view). I have another 4 docs which do a similar thing as this. I will try it out though.

    Thanks for the great assistance all of you. You cannot beat user experience no matter how many books you have (actually I don't have any of either)..

  12. #12
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Peter,

    Is it practical to open the .txt document in Word and bookmark the single line of text excluding the C/R prior to opening or merging the Master file? That's what I did with your files and the C/R was not included in the Master document text. (Of course I had to save the txt file in Word format to keep the bookmark)

    I would suspect that your merging of documents is similar to mine, in that the data you are using in the INCLUDETEXT is constantly changing and therefore modifying the .txt file isn't practical.

    Alan's macro certainly looks insteresting & I think I will have a play with that as I mght have other uses for it. (thanks Alan)

    My only other thought is to insert an ASK field with the INCLUDETEXT field as the default text. The user would then press the end key and backspace keys to delete the hidden C/R. Not an elegant solution (in fact its very ugly) but simple to implement across multiple letters. I've attached a cut down version of your DOC1 document with this ASK field. You could also set the ASK to prompt you once with the o switch.

    Regards,

    Matthew
    Attached Files Attached Files

  13. #13
    New Lounger
    Join Date
    Nov 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Thanks Matthew and you are right, I don't want to have to open the txt file with word and bookmark.

    I actually use FILLIN fields for other stuff as part of the Doc. creation at runtime and orginally had this field setup with a default "venue name" which the user just typed over with their own venue name but that was a bit silly entering this every time. I even looked at the Word option of setting the user entered text as the default on first run but then dispensed with that as it seemed a bit pointless having a textbox that already has the correct information and will never again be modified.

    I have even thought that maybe I could put instructions for the user to create their own Word Doc and bookmark it but the intelligence level is way out there for some of the 250 plus users and I don't want letters going out with Error! Souce code not found.

    No easy answer without VB by the sounds of it.

  14. #14
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Interesting problem.

    One way of dealing with it would be to use a more complicated field like:
    {QUOTE{ASK VenueName "What venue? Eg:{includetext "c:Program FilesTabaret RewardsDataVenue_Name.txt" * MERGEFORMAT}" d {VenueName * MERGEFORMAT}} {VenueName * MERGEFORMAT}}
    What this does is to ask the user to input the venue's name, using the string returned by the include field as a prompt, but defaulting to the last-used venue name as the input. That way, if there's no change, nothing need be entered.

    Hope this helps
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  15. #15
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: INCLUDE FIELDS (WORD2000)

    Well, there may be an easy answer, without disrupting what you already have in place. The problem has me intrigued, and seems to be in the generation of the text file from the batch file. This has now strayed a bit off topic from the Word forum, but since we're here...

    I'm presuming the batch file uses a "redirected to file" echo command, which will always append the newline character. I couldn't find a way round this without writing a dedicated filter program, until I stumbled on this batch file, buried deep within my HD shadows:

    NB: The first line should read like this (remove the underscores):
    @echo _%_dbgn% off
    The board keeps replacing % d b with

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •