Mavila
05-15-2017, 09:48 AM
I'm creating a single document (target) from multiple separate documents (source). I've been using Selection.InsertFile but the formatting of the text is inconsistent. So, I'm going back to copying and pasting the source document contents into the target document.
After each source is pasted into the target, I create a SectionBreak(Next Page). Each section has a header and footer, first page different. The first page header is the title of the source. The second page header is a shape (shaded line). The footers aren't problem.
The target ultimately is constructed by 40 or 50 source documents depending upon the user's needs. It works fine, EXCEPT (there always seems to be an exception) on 2 or 3 of the source documents. When the SectionBreak is inserted, the shaded line is carried over onto the first page of the next section - I can't turn off "LinkToPrevious" until after the SectionBreak is inserted. This isn't a problem because when the new source is pasted (it's copied via selection.wholestory, selection.copy) the shaded line is removed/overwritten.
EXCEPT for these 2 or 3 source files. The line remains. I've tried deleting the line with activedocument.sections.last.headers(wdheaderfooterfirstpage).shapes(1).del ete, activedocument.sections.last.headers(wdheaderfooterfirstpage).range.delete, activedocument.sections.last.headers(wdheaderfooterfirstpage).range.select then selection.delete.
I thought maybe the source file was read only, but that's not the case.
It's as if I can't even get access to the header no matter what I do. It won't even let me insert text into the FirstPage header. It's like it's locked. I'm stumped.
Any ideas what might be going on here?
After each source is pasted into the target, I create a SectionBreak(Next Page). Each section has a header and footer, first page different. The first page header is the title of the source. The second page header is a shape (shaded line). The footers aren't problem.
The target ultimately is constructed by 40 or 50 source documents depending upon the user's needs. It works fine, EXCEPT (there always seems to be an exception) on 2 or 3 of the source documents. When the SectionBreak is inserted, the shaded line is carried over onto the first page of the next section - I can't turn off "LinkToPrevious" until after the SectionBreak is inserted. This isn't a problem because when the new source is pasted (it's copied via selection.wholestory, selection.copy) the shaded line is removed/overwritten.
EXCEPT for these 2 or 3 source files. The line remains. I've tried deleting the line with activedocument.sections.last.headers(wdheaderfooterfirstpage).shapes(1).del ete, activedocument.sections.last.headers(wdheaderfooterfirstpage).range.delete, activedocument.sections.last.headers(wdheaderfooterfirstpage).range.select then selection.delete.
I thought maybe the source file was read only, but that's not the case.
It's as if I can't even get access to the header no matter what I do. It won't even let me insert text into the FirstPage header. It's like it's locked. I'm stumped.
Any ideas what might be going on here?