Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / February 2004

Tip: Looking for answers? Try searching our database.

Table of contents can't be merged

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Håkan Ehrsson - 27 Feb 2004 12:09 GMT
Hi,
I have a VB6 program that performes a MailMerge.
But if my template contains a Table of contents, it will
loose all references when merged.
I read something about problem with FormFields in the
knowledgebase article Q211308, but I can't make it work.

The solution was to loop through all FormFields and store
them temporary, and restore them after the MailMerge.

But in my case the document doesn't contain any text
FormFields, just TOC fields.

Please, does anybody have a clue?
Peter Jamieson - 27 Feb 2004 13:08 GMT
There are two basic problems with merging a TOC:
a. the TOC field is lost - at best, you will see a copy of the /result/ of
the TOC field, possibly including Hyperlinks (each "copy" of the TOC will
convert to exactly the same text and destination bookmarks)
b. all bookmarks are in any case lost, so any hyperlinks wil point to
non-existent destinations.

However, since paragraph styles and TC fields are both preserved, you could
re-insert the necessary TOC field(s) after the merge (perhaps use some
placeholder text or a field that survies the merge to tell you where to put
the TOC), then refresh the document fields. This is obviously easier if you
know what type of TOC field should be in there - if you are trying to write
a generic mailmerger so that anyone's TOC survives the process, you would
probably have to use VB to
a. get the existing TOC field code
b. replace the TOC by placeholder text or whatever
c. proceed as above. You would probably also need to know whether th user
wanted one TOC, or one TOC per section , in the final output.

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> Hi,
> I have a VB6 program that performes a MailMerge.
[quoted text clipped - 10 lines]
>
> Please, does anybody have a clue?
Håkan Ehrsson - 27 Feb 2004 13:37 GMT
It's something like that I tried, but I can't seem to
copy the content back into the field, I get a "type
mismatch" error when assigning a string to Field.Code.
What kind of data should it be?

>-----Original Message-----
>There are two basic problems with merging a TOC:
[quoted text clipped - 36 lines]
>
>.
Peter Jamieson - 27 Feb 2004 13:57 GMT
It's a range.

oField.Code.Text = "TOC etc." should do it, or specify the text when you
invoke oDoc.Fields.Add

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

It's something like that I tried, but I can't seem to
copy the content back into the field, I get a "type
mismatch" error when assigning a string to Field.Code.
What kind of data should it be?

>-----Original Message-----
>There are two basic problems with merging a TOC:
> a. the TOC field is lost - at best, you will see a copy
of the /result/ of
>the TOC field, possibly including Hyperlinks
(each "copy" of the TOC will
>convert to exactly the same text and destination
bookmarks)
> b. all bookmarks are in any case lost, so any
hyperlinks wil point to
>non-existent destinations.
>
>However, since paragraph styles and TC fields are both
preserved, you could
>re-insert the necessary TOC field(s) after the merge
(perhaps use some
>placeholder text or a field that survies the merge to
tell you where to put
>the TOC), then refresh the document fields. This is
obviously easier if you
>know what type of TOC field should be in there - if you
are trying to write
>a generic mailmerger so that anyone's TOC survives the
process, you would
>probably have to use VB to
> a. get the existing TOC field code
> b. replace the TOC by placeholder text or whatever
> c. proceed as above. You would probably also need to
know whether th user
>wanted one TOC, or one TOC per section , in the final
output.

>--
>Peter Jamieson - Word MVP
[quoted text clipped - 3 lines]
>> I have a VB6 program that performes a MailMerge.
>> But if my template contains a Table of contents, it
will
>> loose all references when merged.
>> I read something about problem with FormFields in the
>> knowledgebase article Q211308, but I can't make it
work.

>> The solution was to loop through all FormFields and
store
>> them temporary, and restore them after the MailMerge.
>>
[quoted text clipped - 4 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.