RE: Adding a range object to a Mail Merge field Result



To all out there;

I solved my problem and thought I should post the solution for anyone else
who is looking.

The code required was instead of using:

ReportDoc.fields(i).Result

I added FormattedText to the end to make

ReportDoc.Fields(i).Result.FormattedText = Selection.Range.FormattedText.

This works with only one other issue. It the fields are blank/have no
result to start with, instaed of putting the text in the field, it is added
after the field.
The fix for this is before trying to add a result to a field, to loop
through all the fields and update them. The following code is appropriate:

NumFields = ReportDoc.Fields.Count
For i = 1 to NumFields
ReportDoc.Fields(i).Update
ReportDoc.Fields(i).ShowCodes = True
Next i

Hope this helps someone in the future,
Simon
.



Relevant Pages

  • Re: listbox remove Item
    ... Simon ... What you need to do is loop through each item in the list box and check ... Norie's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=19362 ... Prev by Date: ...
    (microsoft.public.excel.programming)
  • Re: A question about loop with CONTINUE
    ... Simon wrote: ... > - get out of the loop, ... Why are you using such ancient dialect of Fortran? ... Prev by Date: ...
    (comp.lang.fortran)
  • Re: processing a sequence
    ... (loop for sublist = (collect-sublist) ... return accum if not element = list.first ... if prev and element < prev ... James still didn?t show his Ruby one-liner that outperforms the Lisp ...
    (comp.lang.lisp)
  • Re: Process notification
    ... As you see from prev. ... posts there is no obsolute user mode solution on how ... and then immidiatly terminated - your "monitoring loop" may not detect it. ... Vladimir ...
    (microsoft.public.win32.programmer.kernel)
  • RE: Extreme beginner question on reading lines from a file.
    ... print FILEOUT "M98PPECK.SUBL1\n"; ... the 1st line is written into $prev. ... This code will fail if there's ... If it fails it returns false and the loop exits. ...
    (perl.beginners)