Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Is Word 2003 SP2 Mailmerge buggy?

Geek News

Is Word 2003 SP2 Mailmerge buggy?
Mike <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> 12/9/2008 4:09:34 PM
I started out with a text data file layout with such fields as
name, addr1, addr2, addr3, postcode
and from there I built a "labels" mailmerge document

In my excel application, I ask how many avery labels I want to skip,
since I may only be printing one or two labels each time and may have
used labels at the start, so I write the appropriate number of blank
lines with say just 4 vbTab characters

Then I write the data, and open the mailmerge document which uses the
text file as its data source.

Often the first time the processed mailmerge document is produced, the
number of blank labels is wrong - it's usually 1 too many. At this
point I manually took a copy of the data source. My app asks if the
labels were OK, so I say No, and I repeat the process. This time, the
number of blank labels is correct. This is despite the "size"
attribute (not size on disk) for both files being exactly the same.

I didn't have this problem in Word 2000, although when I migrated to
2003 I had to recreate the mailmerge document, because the user
interface I was presented with didn't seem to work quite right on a 200
file (maybe I kept getting popups about version diffs I can't quite
remember)

Anyway I've just managed to find SP3 for 2003, but is this a known bug?
I couldn't find it documented anywhere
--
Mike News
Re: Is Word 2003 SP2 Mailmerge buggy?
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 12/9/2008 7:24:28 PM
Are you writing the text file while the Word mail merge main document is
open, with the .txt file open as the data source? (Actually, I am not sure
that you can do that, but if you can, I'm wondering whether Word can get
confused).

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> wrote in message
news:CZxcqJJ+gpPJFw2j[ at ]turnpike.home...
[Quoted Text]
>I started out with a text data file layout with such fields as
> name, addr1, addr2, addr3, postcode
> and from there I built a "labels" mailmerge document
>
> In my excel application, I ask how many avery labels I want to skip, since
> I may only be printing one or two labels each time and may have used
> labels at the start, so I write the appropriate number of blank lines with
> say just 4 vbTab characters
>
> Then I write the data, and open the mailmerge document which uses the text
> file as its data source.
>
> Often the first time the processed mailmerge document is produced, the
> number of blank labels is wrong - it's usually 1 too many. At this point
> I manually took a copy of the data source. My app asks if the labels were
> OK, so I say No, and I repeat the process. This time, the number of blank
> labels is correct. This is despite the "size" attribute (not size on
> disk) for both files being exactly the same.
>
> I didn't have this problem in Word 2000, although when I migrated to 2003
> I had to recreate the mailmerge document, because the user interface I was
> presented with didn't seem to work quite right on a 200 file (maybe I kept
> getting popups about version diffs I can't quite remember)
>
> Anyway I've just managed to find SP3 for 2003, but is this a known bug? I
> couldn't find it documented anywhere
> --
> Mike News

Re: Is Word 2003 SP2 Mailmerge buggy?
Mike <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> 12/9/2008 8:36:36 PM
In message <OFHBEPjWJHA.1268[ at ]TK2MSFTNGP04.phx.gbl>
at 19:24:28 on Tue, 9 Dec 2008, Peter Jamieson
<pjj[ at ]KillmapSpjjnet.demon.co.uk> wrote
[Quoted Text]
>Are you writing the text file while the Word mail merge main document is
>open, with the .txt file open as the data source? (Actually, I am not sure
>that you can do that, but if you can, I'm wondering whether Word can get
>confused).
>
Thanks for your reply

No - I format my text file using this sort of code

giHandle = FreeFile
Open ThisWorkbook.Path & "\EbayLabelsData.doc" For Output As #giHandle

Print #giHandle, lsHeader

For liCount = 1 To liSkip
Print #giHandle, lsBlank
Next

# Print a line of data
Print #giHandle, lsString

Close #giHandle


And then immediately open the mail merge main document.


'************************
'* Open Labels document *
'************************
Sub WordLabels()

Dim loWord As Word.Application


'See if word's already running
On Error Resume Next
Set loWord = GetObject(, "Word.Application")
If Err Then
'No, so start a new word session
Set loWord = New Word.Application
Err.Clear
End If

loWord.Documents.Open (ThisWorkbook.Path & "\EbayLabelsV2.doc")
loWord.WindowState = wdWindowStateMaximize
SetQueue loWord
loWord.Visible = True
loWord.Activate
WaitDocClose loWord

Set loWord = Nothing

End Sub


Should I put a small delay in before calling WordLabels, or could this
be coded in a better way. SetQueue is a procedure I have for changing
my default print queue to the one I use for labels. Once the document
appears, I then manually select File/Print
--
Mike News
Re: Is Word 2003 SP2 Mailmerge buggy?
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 12/9/2008 9:49:05 PM
Mike-

I'll have a look, but it won't be today.


--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> wrote in message
news:k9bVD$IUbtPJFwRX[ at ]turnpike.home...
[Quoted Text]
> In message <OFHBEPjWJHA.1268[ at ]TK2MSFTNGP04.phx.gbl>
> at 19:24:28 on Tue, 9 Dec 2008, Peter Jamieson
> <pjj[ at ]KillmapSpjjnet.demon.co.uk> wrote
>>Are you writing the text file while the Word mail merge main document is
>>open, with the .txt file open as the data source? (Actually, I am not sure
>>that you can do that, but if you can, I'm wondering whether Word can get
>>confused).
>>
> Thanks for your reply
>
> No - I format my text file using this sort of code
>
> giHandle = FreeFile
> Open ThisWorkbook.Path & "\EbayLabelsData.doc" For Output As #giHandle
>
> Print #giHandle, lsHeader
>
> For liCount = 1 To liSkip
> Print #giHandle, lsBlank
> Next
>
> # Print a line of data
> Print #giHandle, lsString
>
> Close #giHandle
>
>
> And then immediately open the mail merge main document.
>
>
> '************************
> '* Open Labels document *
> '************************
> Sub WordLabels()
>
> Dim loWord As Word.Application
>
>
> 'See if word's already running
> On Error Resume Next
> Set loWord = GetObject(, "Word.Application")
> If Err Then
> 'No, so start a new word session
> Set loWord = New Word.Application
> Err.Clear
> End If
>
> loWord.Documents.Open (ThisWorkbook.Path & "\EbayLabelsV2.doc")
> loWord.WindowState = wdWindowStateMaximize
> SetQueue loWord
> loWord.Visible = True
> loWord.Activate
> WaitDocClose loWord
>
> Set loWord = Nothing
>
> End Sub
>
>
> Should I put a small delay in before calling WordLabels, or could this
> be coded in a better way. SetQueue is a procedure I have for changing
> my default print queue to the one I use for labels. Once the document
> appears, I then manually select File/Print
> --
> Mike News

Re: Is Word 2003 SP2 Mailmerge buggy?
Mike <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> 12/9/2008 11:20:28 PM
In message <#XUl5fkWJHA.556[ at ]TK2MSFTNGP06.phx.gbl>
at 21:49:05 on Tue, 9 Dec 2008, Peter Jamieson
<pjj[ at ]KillmapSpjjnet.demon.co.uk> wrote
[Quoted Text]
>
>Mike-
>
>I'll have a look, but it won't be today.
>
Cheers. I've lived with this bug for about 18 months now - a few more
days won't hurt
--
Mike News
Re: Is Word 2003 SP2 Mailmerge buggy?
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 12/10/2008 6:45:20 PM
Hi Mike,

I tried the Excel VBA code below (you don't actually need any data in the
sheet), using Word 2003 SP/3/ (which is the nearest I can get, at least
reasonably easily) and so far always get 3 blank labels as the code
suggests.

Maybe you could
a. try it at your end and see whether you get the same result, or type of
result, that you have been getting so far
b. tell me whether I am obviously not testing the same thing as you (e.g. I
think I am creating a header, three blank tab-delimited records, then some
non-blank records)

If (b) is OK but you are still seeing inconsistent behaviour, I suppose it
either has to be
c. SP2 v. SP3 or
d. some other configuration difference between our systems (e.g. I am
running XP on a Virtual machine here and disk-related operations may go much
faster than on a real machine) or
e. something you are doing, i.e. almost certainly in SetQueue

'Here it is
Sub openit()
Dim giHandle As Integer
Dim liCount As Integer
Dim liSkip As Integer
Dim liLabels As Integer
Dim lsBlank As String
Dim lsHeader As String
Dim lsLabel As String
giHandle = FreeFile
lsHeader = "k" & vbTab & "field1" & vbTab & "field2"
lsBlank = vbTab & vbTab
liSkip = 3
liLabels = 20
Open ThisWorkbook.Path & "\LabelsData.doc" For Output As #giHandle

Print #giHandle, lsHeader

For liCount = 1 To liSkip
Print #giHandle, lsBlank
Next

'# Print some lines of data
For liCount = 1 To liLabels
lsLabel = CStr(liSkip + liCount)
Print #giHandle, lsLabel & vbTab & "data" & lsLabel & "1" & vbTab & "data"
& lsLabel & "2"
Next

Close #giHandle

Call WordLabels

End Sub

'************************
'* Open Labels document *
'************************
Sub WordLabels()

Dim loWord As Word.Application
Dim loDoc As Word.Document
'See if word's already running
On Error Resume Next
Set loWord = GetObject(, "Word.Application")
If Err Then
'No, so start a new word session
Set loWord = New Word.Application
Err.Clear
End If

Set loDoc = loWord.Documents.Open(ThisWorkbook.Path & "\LabelsV2.doc")
loWord.WindowState = wdWindowStateMaximize
'SetQueue loWord
loWord.Visible = True
loWord.Activate
loDoc.MailMerge.Destination = wdSendToNewDocument

loDoc.MailMerge.Execute

'WaitDocClose loWord
loDoc.Close savechanges:=wdDoNotSaveChanges

Set loDoc = Nothing
' do not quit word
Set loWord = Nothing

End Sub


--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> wrote in message
news:p$B2j1K80vPJFwQ0[ at ]turnpike.home...
[Quoted Text]
> In message <#XUl5fkWJHA.556[ at ]TK2MSFTNGP06.phx.gbl>
> at 21:49:05 on Tue, 9 Dec 2008, Peter Jamieson
> <pjj[ at ]KillmapSpjjnet.demon.co.uk> wrote
>>
>>Mike-
>>
>>I'll have a look, but it won't be today.
> >
> Cheers. I've lived with this bug for about 18 months now - a few more
> days won't hurt
> --
> Mike News

Re: Is Word 2003 SP2 Mailmerge buggy?
Mike <turnpike_user[ at ]turnpike_REMOVEuser.THIScomANDTHIS> 12/11/2008 5:44:34 PM
In message <#wqPVGwWJHA.4184[ at ]TK2MSFTNGP06.phx.gbl>
at 18:45:20 on Wed, 10 Dec 2008, Peter Jamieson
<pjj[ at ]KillmapSpjjnet.demon.co.uk> wrote
[Quoted Text]
>Hi Mike,
>
Hi thanks for your reply.

>I tried the Excel VBA code below (you don't actually need any data in
>the sheet), using Word 2003 SP/3/ (which is the nearest I can get, at
>least reasonably easily) and so far always get 3 blank labels as the
>code suggests.
>
>Maybe you could
>a. try it at your end and see whether you get the same result, or type
>of result, that you have been getting so far
>b. tell me whether I am obviously not testing the same thing as you
>(e.g. I think I am creating a header, three blank tab-delimited
>records, then some non-blank records)
>
That's spot on yes


>If (b) is OK but you are still seeing inconsistent behaviour, I suppose
>it either has to be
>c. SP2 v. SP3 or
>d. some other configuration difference between our systems (e.g. I am
>running XP on a Virtual machine here and disk-related operations may go
>much faster than on a real machine) or
>e. something you are doing, i.e. almost certainly in SetQueue
>
>'Here it is
>Sub openit()
>Dim giHandle As Integer
>Dim liCount As Integer
>Dim liSkip As Integer
>Dim liLabels As Integer
>Dim lsBlank As String
>Dim lsHeader As String
>Dim lsLabel As String
>giHandle = FreeFile
>lsHeader = "k" & vbTab & "field1" & vbTab & "field2"
>lsBlank = vbTab & vbTab
>liSkip = 3
>liLabels = 20
>Open ThisWorkbook.Path & "\LabelsData.doc" For Output As #giHandle
>
>Print #giHandle, lsHeader
>
>For liCount = 1 To liSkip
> Print #giHandle, lsBlank
>Next
>
>'# Print some lines of data
>For liCount = 1 To liLabels
> lsLabel = CStr(liSkip + liCount)
> Print #giHandle, lsLabel & vbTab & "data" & lsLabel & "1" & vbTab &
>"data" & lsLabel & "2"
>Next
>
>Close #giHandle
>
>Call WordLabels
>
>End Sub
>
>'************************
>'* Open Labels document *
>'************************
>Sub WordLabels()
>
>Dim loWord As Word.Application
>Dim loDoc As Word.Document
>'See if word's already running
>On Error Resume Next
>Set loWord = GetObject(, "Word.Application")
>If Err Then
> 'No, so start a new word session
> Set loWord = New Word.Application
> Err.Clear
>End If
>
>Set loDoc = loWord.Documents.Open(ThisWorkbook.Path & "\LabelsV2.doc")
>loWord.WindowState = wdWindowStateMaximize
>'SetQueue loWord
>loWord.Visible = True
>loWord.Activate
>loDoc.MailMerge.Destination = wdSendToNewDocument
>
>loDoc.MailMerge.Execute
>
>'WaitDocClose loWord
>loDoc.Close savechanges:=wdDoNotSaveChanges
>
>Set loDoc = Nothing
>' do not quit word
>Set loWord = Nothing
>
>End Sub
>
>
Pete
I'll get back to you later - the only thing we do fundamentally
different is I do the mailmerge within my mailmerge document

Private Sub Document_Open()

MailMerge.Execute

'Set properties of created mail merge, so the 'do you want to
' save' message doesn't appear
ActiveDocument.Saved = True

'Close the mail merge main document
ThisDocument.Close True

End Sub

but I will try moving it outside as per your suggestion

SetQueue could be interfering I suppose - although it's not altering the
layout of the document
--
Mike News

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net