Odd mailmerge hassle...?

K

Kenneth

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,
 
S

Suzanne S. Barnhill

Are you sure you're actually completing the merge and not just previewing
the results?
 
K

Kenneth

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,
 
K

Kenneth

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,
 
K

Kenneth

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

news:[email protected]...


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,
 
B

Beth Melton

Kenneth said:
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,

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
 
K

Kenneth

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

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,
 
K

Kenneth

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,

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,
 
B

Beth Melton

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?

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
 
K

Kenneth

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

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,
 
B

Beth Melton

Kenneth said:
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top