Results 1 to 4 of 4
  1. #1
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts

    Merge Letter has different name? (2002-2003)

    Hi all,

    I'm trying to manipulate a document immediately after a merge. The document caption says its name is "Letters1" but if I query it in VBA, it comes up as "Form Letters1"

    If I use Set oDoc = ActiveDocument and hover over oDoc -- it displays "Form Letters1"

    When I try to manipulate it using VBA (inserting a graphic in the header based on specific criteria), it doesn't work. It does work in a saved document. Do I need to save a document before I can address it as a document object?

    Thanks!
    Kim

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Merge Letter has different name? (2002-2003)

    Executing a mail merge makes the resulting document the active document, so

    Set oDoc = ActiveDocument

    will set a reference to the merged document. It should be possible to manipulate this document without saving it - I've often used this to post-process the merged document. To test, I've run one of my existing macros that modifies the text of the page header of the merged document, and it worked OK...

  3. #3
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts

    Re: Merge Letter has different name? (2002-2003)

    Never mind! Never Mind!

    The problem was one of formatting. The document was not set up with first page different, and the macro is addressing the First Page Header.

    Doh!

    Kim <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Merge Letter has different name? (2002-2003)

    You could test:

    If Not ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Exists Then
    MsgBox "Document hasn't been set up correctly!"
    Exit Sub
    End If

Posting Permissions

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