Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JRB JRB is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JRB JRB is offline
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy entries short procedure required gandhi318 Excel Worksheet Functions 1 December 30th 05 12:28 PM
Calling a procedure in a procedure Norman Jones Excel Programming 8 August 20th 04 07:53 PM
Calling a procedure in a procedure N10 Excel Programming 2 August 18th 04 12:49 AM
Calling a procedure in a procedure Don Guillett[_4_] Excel Programming 1 August 17th 04 11:31 PM


All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"