Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help required to debug mailmerge procedure
I am attempting to run a mailmerge from Excel (Office 97) using the
following procedu 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 .............. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help required to debug mailmerge procedure
Do you have a reference set to the Word Object Library in the Excel VBE
under the References menu -- Regards, Tom Ogilvy "JRB" wrote in message ... I am attempting to run a mailmerge from Excel (Office 97) using the following procedu 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 ............. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help required to debug mailmerge procedure(2)
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 "JRB" wrote in message ... I am attempting to run a mailmerge from Excel (Office 97) using the following procedu 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 ............. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Easy entries short procedure required | Excel Worksheet Functions | |||
Calling a procedure in a procedure | Excel Programming | |||
Calling a procedure in a procedure | Excel Programming | |||
Calling a procedure in a procedure | Excel Programming |