Help required to debug mailmerge procedure

J

JRB

I am attempting to run a mailmerge from Excel (Office 97) using the
following procedure:
It doesn't work .... and I am tearing my hair out - please help before I am
completely bald
TIA

..............
Sub PrintLabels()

Dim WD As Object

Set WD = CreateObject("Word.Application")
WD.Application.DisplayAlerts = wdAlertsNone
WD.Documents.Open (ThisWorkbook.Path & "\BDayList Labels.doc")
WD.ActiveDocument.Mailmerge.Destination = wdSendToPrinter
WD.ActiveDocument.Mailmerge.Execute
WD.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
WD.Application.DisplayAlerts = wdAlertsAll
WD.Quit SaveChanges:=wdDoNotSaveChanges
Set WD = Nothing

End Sub
..............
 
T

Tom Ogilvy

Do you have a reference set to the Word Object Library in the Excel VBE
under the References menu
 
J

JRB

I have the following references set up (not sure whether they were set up
when I posted original request)

Visual Basic for Applications
Microsoft Excel 8.0 Object Library
OLE Automation
Microsoft Word 8.0 Object Library
Microsoft Office 8.0 Object Library
Microsoft Forms 2.0 Object Library

I have been testing with only one page of labels to be printed and although
the procedure now seems to work it takes a long time ... in fact I get an
Message box displayed saying:
"Task is taking longer than expected Do you want to continue ?"

On other occasions I have received the message "Excel is waiting for another
application to complete an OLE action" and I eventually have to resort to
Task manager to end either the Print process or Word before I can regain
control of the spreadsheet

Have you any suggestions re speeding up the process
I am using WinXP and Office97 on P3 with 256Mb RAM

Regards and thanks
Jim Burton
 

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