Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Northern, California, USA
    Thanked 0 Times in 0 Posts

    Document Merge (97 SR2)

    Here's a hairy one..

    I have two documents i'm using to create a help system for the company. One document contains developers comments, the other contains what the end user will see. Each document is 164 pages long, and each page corresponds with one another.

    How can I take the developers comments and merge them with what the user will see, adding the dev comments to the footer of each corresponding page?

    Is there a way to identify the first sentance in the pages and merge them this way? The first sentance is the same.

    The problem i'm having is scripting out a method for identifying the following:

    If the sentance at the top of page x of document 1 is the same as the sentance at the top of page y of document 2, then merge page from document to footer of document 2.

    Any Ideas?
    <IMG SRC=>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Sun Prairie, Wisconsin, Wisconsin, USA
    Thanked 128 Times in 123 Posts

    Re: Document Merge (97 SR2)

    I don't think you can do it in the footer because the footer is not really in any particular place, but I suppose you could try and see what happens.

    First, do the following on backups, especially of document 1.

    Start by bookmarking each page (the entire page) in document 2, naming the bookmarks with the same name except for a number corresponding to the page number.

    Next, in document 1, use an includetext field that includes a document 1#bookmark{PAGE}.

    Put that IncludeText field in a footer and see what happens. Might be interesting!

    If it doesn't work, but doesn't destroy your document either, try the IncludeText field in the body of document1, you would have to put it on each page but could store it as an AutoText entry to make this easier.

    If it does work in the footer, you could even try creating a new document 3, bookmarking each page in document 1 and creating an IncludeText field for the header of document 3 that inserts the text from document 1 while the one in the footer includes from document 2. All you have to do then is manual page breaks to generate your document.

    If you try it, please let us know if it works.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Document Merge (97 SR2)

    I had skimmed over the part about footers before, but perhaps it would be easier to replace all manual page breaks with section breaks. VBA is very happy flipping from section to section, and each section's footer can be distinct. There's still plenty 'o programming to do, but how does it sound so far?

    If the document can be easily sectioned, then the code would be along these lines:

    Set docUser = ActiveDocument
    Set docDeveloper = Documents.Open(FileSpec)

    For intSection = 1 to docUser.Sections.Count
    Set rngSectionText = docDeveloper.Sections(intSection).Range
    With rngSectionText
    .MoveEnd Unit:=wdCharacter, Count:=-1 'deselect section break
    End With
    With docUser.Sections(intSection).Footers(wdHeaderFoote rPrimary)
    .LinkToPrevious = False
    End With

    Of course, you don't need to copy and paste if there is no formatting to preserve. Direct assignment of the .Text from one Range to the other likely would be faster.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts