Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2011, 03:13 AM
HorizonSC HorizonSC is offline VBA Print Command Prints Document Twice Windows Vista VBA Print Command Prints Document Twice Office 2003
Novice
VBA Print Command Prints Document Twice
 
Join Date: Sep 2011
Posts: 5
HorizonSC is on a distinguished road
Default VBA Print Command Prints Document Twice

Hi all, I wrote some very simple VBA code to call up the print dialogue when a command button within the document is clicked. The dialogue code is as below:
Code:
Sub Display_Print_Dialog_CustomAll()
     With Dialogs(wdDialogFilePrint)
         .Range = wdPrintRangeOfPages
         .Pages = "2-8"
          If .Show = -1 Then .Execute
     End With
 End Sub
and then the command button code:


Code:
Private Sub CommandButton09_Click()
   Display_Print_Dialog_CustomAll
End Sub
However, when the button is clicked, the print dialogue comes up only once, and with only the correctly specified number of copies (1), yet sends the job to the printer twice. I have checked to ensure no copies of the macro exist within the normal template, and also that there are no function with the same name - However, I'm at a complete loss as to go about solving the issue since I've only learned VBA in the last month or so.

Hope someone can offer some advice, and thanks in advance,
Reply With Quote
  #2  
Old 11-13-2011, 04:15 AM
macropod's Avatar
macropod macropod is offline VBA Print Command Prints Document Twice Windows 7 64bit VBA Print Command Prints Document Twice Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi HorizonSC,

Change:
If .Show = -1 Then .Execute
to:
.Show
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-15-2011, 03:26 AM
HorizonSC HorizonSC is offline VBA Print Command Prints Document Twice Windows Vista VBA Print Command Prints Document Twice Office 2003
Novice
VBA Print Command Prints Document Twice
 
Join Date: Sep 2011
Posts: 5
HorizonSC is on a distinguished road
Default

Thanks, it worked! Consider this resolved.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Print Command Prints Document Twice embed autocad drawing in word document prints very light gbehm@broan.com Drawing and Graphics 1 03-15-2011 08:05 PM
How can I print out the document as follow? turbomen Project 1 05-23-2010 07:24 AM
When I print the document changes layout cooney Word 0 03-01-2010 12:17 AM
print file is 14MB when document is only 850kb pompeydave PowerPoint 0 06-01-2009 05:58 PM
Print spacing in Word document veekay99 Word 16 04-21-2009 01:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:32 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft