My first post!
The Problem Domain
I'm writing a VBA program that builds a Word document from data pulled from a large excel spreadsheet. I build up a temporary word document, lets call it "doc1", and then when that's done I want to append it to the end of "doc2". Once appended, I throw away doc1 and build a new one w/ subsequent rows/records from the spreadsheet. Append it to doc2, repeat till I run out of data.
What I need from Y'all
I need to know how to go to the end of doc2. Then, I need to know how to properly copy all of doc1 and then append it to doc2. I need to carry over all the formatting which includes some horizontal lines (paragraph border, really), borders around a couple of paragraphs, boldface.
Here's how I'm going to the end of the doucment:
Do I need to collapse the selection? Or do anything else prior to inserting more text?
Here is how I'm copying over the other document:
theReport.range.text = newPage.Content
The problem here is that the entire receiving document, theReport, is being overwritten from the newPage.Content. The other problem is that the formatting is disappearing in the transfer. No boldface, no borders around certain paragraphs, no horizontal line. Oh, and the user-defined bookmarks are gone too - but that's a good thing. I do know how to delete them if I had to.
Clearly I'm not fully understanding ranges and selections.
Things I'm doing right
I'm connecting to the excel spreadsheet and fetching the data. The overall program control structure is working. I'm able to get the data onto the temporary document where I want it via user-defined bookmarks. It looks like I'm putting the cursor at the end of theReport and inserting a page break.