Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Document Management / May 2008

Tip: Looking for answers? Try searching our database.

Odd mailmerge hassle...?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kenneth - 23 May 2008 22:29 GMT
Howdy,

This one is easy to describe, but I have not seen it before
(despite a fair amount of experience with mailmerge
macros)...

I am running Word 2002 under XP.

I'm in the process of setting up a macro to run a mailmerge
that will print a single letter with a number of fields.

The merge works fine, almost...

When I merge (either to a new document, or to the printer)
the letter prints properly, but first, the form letter
document prints (with all the field place holders, but with
no data inserted.)

So, when I merge a one page letter, two pages come off the
printer.

The first lines of page 1 to come off the printer looks like
this:

Dear <<FirstName>>

We hope that you and <<PetName>> are doing well, and that
you both enjoy using our <<RecentPurchase>>...

after that, the next page off the printer looks like this:

Dear Joey,

We hope that you and Lekvar are doing well, and that you
both enjoy using our Solid Platinum Dog Bowl...

I'm baffled...

Might you know of a cause of this sort of thing?

Sincere thanks,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Suzanne S. Barnhill - 23 May 2008 23:43 GMT
Are you sure you're actually completing the merge and not just previewing
the results?

Signature

Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

> Howdy,
>
[quoted text clipped - 37 lines]
>
> Sincere thanks,
Kenneth - 24 May 2008 00:22 GMT
>Are you sure you're actually completing the merge and not just previewing
>the results?

Hi Suzanne,

I had the result I described when I clicked the "Merge to
New Document" button, and also when I clicked the "Merge to
Printer" button.

Thanks for any further thoughts,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

BoniM - 24 May 2008 01:42 GMT
Could you post your code, please?

> Howdy,
>
[quoted text clipped - 37 lines]
>
> Sincere thanks,
Kenneth - 24 May 2008 03:18 GMT
>> Howdy,
>>
[quoted text clipped - 37 lines]
>>
>> Sincere thanks,

>Could you post your code, please?

Hi again,

The code appears below...

I should also add that my comment about "experience" with
mailmerge macros could easily be misinterpreted...

I am indeed experienced, but really don't have much of a
clue about the code. My method is "R&T" (record and tweak)
and it has served me (reasonably) well.

Also, so that the code will make some sense:

The document "Program Welcome Letter.Doc" is set up as the
form letter, and it is "linked" to a particular data file.

The way all this works is that working in my database
(Paradox) I click to dump the data as a TXT file, launch
Word, and run the macro above. With that, the single
welcoming letter is printed.

Here's the code:

Sub ProgramWelcomeLetters()
'
' ProgramWelcomeLetters Macro
' Macro recorded 5/23/2008 by
'
   Documents.Open
FileName:="""F:\KSAPROGS\FormLetters\Program Welcome
Letter.doc""", _
       ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
       PasswordDocument:="", PasswordTemplate:="",
Revert:=False, _
       WritePasswordDocument:="",
WritePasswordTemplate:="", Format:= _
       wdOpenFormatAuto
   With ActiveDocument.MailMerge
       .Destination = wdSendToPrinter
       .SuppressBlankLines = True
       With .DataSource
           .FirstRecord = wdDefaultFirstRecord
           .LastRecord = wdDefaultLastRecord
       End With
       .Execute Pause:=False
   End With
End Sub

As I have described, running this code first prints the
formletter itself (with the fields as "placeholders") and
then prints the formletter (with the data inserted
properly.)

As before, sincere thanks for any help,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Beth Melton - 24 May 2008 19:21 GMT
Have you checked your data source and verified the header row? It sounds
like you may have two header rows. Have you also tried previewing the
results to see if the odd record shows up?

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
https://mvp.support.microsoft.com/profile/Melton
What is a Microsoft MVP?  http://mvp.support.microsoft.com/gp/mvpfaqs

Guides for the Office 2007 Interface:
http://office.microsoft.com/en-us/training/HA102295841033.aspx

> Howdy,
>
[quoted text clipped - 37 lines]
>
> Sincere thanks,
Kenneth - 24 May 2008 21:22 GMT
>Have you checked your data source and verified the header row? It sounds
>like you may have two header rows. Have you also tried previewing the
[quoted text clipped - 8 lines]
>Guides for the Office 2007 Interface:
>http://office.microsoft.com/en-us/training/HA102295841033.aspx

Hi Beth,

I just looked at the data source, and there is a single
header row, and it properly matches the data themselves.

When you ask about preview, I am not sure I know what you
mean.

I typically check these things by merging to a doc. If that
is what you meant, the answer is yes, I have done that, and
both pages (that eventually print) display.

Thanks for any further help,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Beth Melton - 25 May 2008 00:23 GMT
>>Have you checked your data source and verified the header row? It sounds
>>like you may have two header rows. Have you also tried previewing the
[quoted text clipped - 13 lines]
>
> Thanks for any further help,

By Preview Results I mean use the Preview button on the Mail Merge toolbar.
If memory serves, it looks something like <<ABC>>. This will allow you to
view an overlay of your records on the main document.

Also, did you check your Header Options? If you are also providing a Header
Row for the merge using another file then the first record in your data
source will be treated as a record.

Additionally, does the same result occur if you don't use your macro?

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
https://mvp.support.microsoft.com/profile/Melton
What is a Microsoft MVP?  http://mvp.support.microsoft.com/gp/mvpfaqs

Guides for the Office 2007 Interface:
http://office.microsoft.com/en-us/training/HA102295841033.aspx
Kenneth - 27 May 2008 03:22 GMT
>>>Have you checked your data source and verified the header row? It sounds
>>>like you may have two header rows. Have you also tried previewing the
[quoted text clipped - 32 lines]
>Guides for the Office 2007 Interface:
>http://office.microsoft.com/en-us/training/HA102295841033.aspx

Hi Beth,

I just checked, and yes, when I do the merge manually, that
is, without the macro, the Preview Button <<abc>> shows the
header data.

When I saw that, I opened the data source yet again, and
confirmed that it consists only of two records. The first is
the "header" and the second, the data I want merged.

Yet, for some reason, Word seems to take both records as
data, and by any method (preview, merge to a new doc, or
merge to printer) produces two pages.

Thanks for any further thoughts,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Kenneth - 27 May 2008 04:35 GMT
>>>>Have you checked your data source and verified the header row? It sounds
>>>>like you may have two header rows. Have you also tried previewing the
[quoted text clipped - 48 lines]
>
>Thanks for any further thoughts,

Hi again Beth,

I have continued to think about this, and may have a
thought...

Suppose I inadvertently set the formletter doc to use a file
as the header for field assignments, and also included that
list of field assignments as the "first record" in the data
list.

It seems that I would then have the situation I have
described, that is, Word would use the header file, and
would then see my datafile as having two records (rather
than the one I intend.)

In Word 2000, I knew how to find the setting that told a
formletter to use such a header file, but in 2002, despite
lots of work with the help file, I can't find the setting.

Where should I be looking?

Sincere thanks, as before,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Beth Melton - 27 May 2008 18:47 GMT
>>>>>Have you checked your data source and verified the header row? It
>>>>>sounds
>>>>>like you may have two header rows.

> I have continued to think about this, and may have a
> thought...
[quoted text clipped - 14 lines]
>
> Where should I be looking?

The best way to find it is to add the old Mail Merge Helper. To do so, go to
Tools/Customize. On the Commands tab select All Commands, locate Mail Merge
Helper, and then drag/drop it on any toolbar (I'd use the Mail Merge toolbar
for this command). Then when you run the Mail Merge Helper, use the Data
Source options and see if you have a Header Source attached.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
https://mvp.support.microsoft.com/profile/Melton
What is a Microsoft MVP?  http://mvp.support.microsoft.com/gp/mvpfaqs

Guides for the Office 2007 Interface:
http://office.microsoft.com/en-us/training/HA102295841033.aspx
Kenneth - 27 May 2008 18:59 GMT
>The best way to find it is to add the old Mail Merge Helper. To do so, go to
>Tools/Customize. On the Commands tab select All Commands, locate Mail Merge
[quoted text clipped - 10 lines]
>Guides for the Office 2007 Interface:
>http://office.microsoft.com/en-us/training/HA102295841033.aspx

Hi Beth,

Many thanks for your kind help...

I've resolved the matter by re-building from scratch, and am
pleased to report that all is well.

All the best,
Signature

Kenneth

If you email... Please remove the "SPAMLESS."

Beth Melton - 27 May 2008 20:22 GMT
>>The best way to find it is to add the old Mail Merge Helper. To do so, go
>>to
[quoted text clipped - 11 lines]
> I've resolved the matter by re-building from scratch, and am
> pleased to report that all is well.

I'm glad to hear you have it worked out. I suspect you did have a header
source specified so if it should happen again you'll know more about where
to look. :-)

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
https://mvp.support.microsoft.com/profile/Melton
What is a Microsoft MVP?  http://mvp.support.microsoft.com/gp/mvpfaqs

Guides for the Office 2007 Interface:
http://office.microsoft.com/en-us/training/HA102295841033.aspx
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.