Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
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 |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
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" S wrote in message ... 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 |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
In message
at 19:24:28 on Tue, 9 Dec 2008, Peter Jamieson 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 |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
Mike-
I'll have a look, but it won't be today. -- Peter Jamieson http://tips.pjmsn.me.uk "Mike" S wrote in message ... In message at 19:24:28 on Tue, 9 Dec 2008, Peter Jamieson 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 |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
In message
at 21:49:05 on Tue, 9 Dec 2008, Peter Jamieson 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 |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
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" S wrote in message news In message at 21:49:05 on Tue, 9 Dec 2008, Peter Jamieson 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 |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is Word 2003 SP2 Mailmerge buggy?
In message
at 18:45:20 on Wed, 10 Dec 2008, Peter Jamieson wrote 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Buggy tables and styles | Tables | |||
Wildcard search... buggy? | Microsoft Word Help | |||
Word Bug: Find/Replace wildcards while track changes is turned on is buggy | Microsoft Word Help | |||
buggy new-page layout in Word 2003 | Page Layout | |||
Buggy Hyperlink in Word | Microsoft Word Help |