Keeping Endnotes with the owner when combining multiple documents.

M

Mike

Hi! I am combining several documents using InsertFile() command. It works OK
but when a document has endnotes, the endnotes go to the end of the resulting
document.

I tried Cut and Paste but that removed the endnotes numbering.

What can I do to keep the endnotes with their original owner?


Thank you in advance,

--Michael
 
J

Jezebel

Insert section breaks between the inserted documents and put the endnotes at
'End of Section'
 
M

Mike

Hi! Thank you for getting back to me. How do I put the endnotes at "End of
Section" ?

Many Thanks in Advance,

--Michael
 
M

Mike

Hi! I am sorry I am not explaining myself clearly today. I do not have any
control over how documents are created. Some of them might have endnotes. I
am looping over the documents in a folder programmatically with C# and/or VB
and merge them together using InsertFile() of the Selection object.
When I encouter an endnote I need to make sure it stays with the original
document and does not go to the end of the resulting document.
Sorry for the confusion. Perhaps it's I who's confused ?

Numerous thanks in advance,

-- Michael
 
J

Jezebel

Your loop code needs to be something like this --

For each sourcedocument

If not the first document then
activedocument.Content.InsertBreak wdSectionBreakNextPage
end if

activedocument.Content.InsertFile sourcedocument_filename

activedocument.Sections(activedocument.Sections.Count).Range.EndnoteOptions.Location
= wdEndOfSection

Next
 
M

Mike

Thank you very much for your advice. It's always on the $.

I have to use Word.WdBreakType.wdSectionBreakContinuous
to append the documents together w/out space in between.
What can I do in such case ?

Many Thanks in Advance,

--Michael
 
J

Jezebel

Then use it --

activedocument.Content.InsertBreak wdSectionBreakContinuous

Has no effect on the rest of the routine. However, it subsequently occurred
to me that you will have a problem if the inserted documents themselves
contain section breaks. Need to think again if that's the case.... :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top