Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

cancel print in macro

 
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming
View previous topic :: View next topic  
Author Message
Curt
Guest





PostPosted: Mon Nov 12, 2007 6:45 pm    Post subject: cancel print in macro Reply with quote

when macro runs all is ok. If you cancel print then it goes back to vba.
Looking for a way to close merge document if user cancels print
Here is what I've got
It hangs on execute pause:
Thanks fo help I'm stumped
Sub maile()
' maile Macro
' Macro recorded 8/14/2007 by Curtiss A. Greer
ChangeFileOpenDirectory "\Parade\"
Documents.Open FileName:="ThankMailE.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False (this is where it hangs up have used true also)
End With
End Sub
Back to top
Google
Sponsor





PostPosted: Mon Nov 12, 2007 6:45 pm    Post subject: Advertisement

Back to top
Doug Robbins - Word MVP
Guest





PostPosted: Tue Nov 13, 2007 4:15 am    Post subject: Re: cancel print in macro Reply with quote

See the article "How to do a mail merge to the printer using VBA, without
displaying the Print dialog" at:

http://www.word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Curt" <Curt@discussions.microsoft.com> wrote in message
news:967B0CD5-52F7-49C3-91C8-953EB34696E4@microsoft.com...
Quote:
when macro runs all is ok. If you cancel print then it goes back to vba.
Looking for a way to close merge document if user cancels print
Here is what I've got
It hangs on execute pause:
Thanks fo help I'm stumped
Sub maile()
' maile Macro
' Macro recorded 8/14/2007 by Curtiss A. Greer
ChangeFileOpenDirectory "\Parade\"
Documents.Open FileName:="ThankMailE.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False (this is where it hangs up have used true
also)
End With
End Sub
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Computer Forum