RE: Adding a range object to a Mail Merge field Result
- From: "Simon" <Simon@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 May 2005 01:43:21 -0700
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
.
- References:
- Prev by Date: Re: Using DAO from Microsoft Word
- Next by Date: identifying lists in a selection
- Previous by thread: Adding a range object to a Mail Merge field Result
- Next by thread: Can I use a macro to break up doc into separate files?
- Index(es):
Relevant Pages
|