View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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