Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2020, 02:02 PM
trevorc trevorc is offline Print preview and print dialog Windows 7 32bit Print preview and print dialog Office 2013
Competent Performer
Print preview and print dialog
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default Print preview and print dialog

Back again,
Still trying to sort out this printing option,
When i select File then print, I get the print and print preview dialog, I also get this if I hit CTRL P on the keyboard.
But if i use - Application.SendKeys ("^P") in VBA it brings up the format cells dialog.



How do I get the print and print preview dialog displayed using VBA ????
Reply With Quote
  #2  
Old 07-21-2020, 02:31 PM
trevorc trevorc is offline Print preview and print dialog Windows 7 32bit Print preview and print dialog Office 2013
Competent Performer
Print preview and print dialog
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

I just tried this - Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
It does bring up the print and print preview dialog, but the printer I want selected isn't. See code below, it seems to go looking for the default printer, any ideas how i can get around this?

Code:
Sub AAA()
    Application.EnableEvents = False
    Select Case ActiveSheet.Name
        Case Is = "Mac Label"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "Address Label"
            Application.ActivePrinter = "ZDesigner GK420t on 9100"
        Case Is = "Repair Labels"
            Application.ActivePrinter = "\\U2-front-desk\bixolon slp-d420 on Ne05:"
        Case Is = "Labels"
            Application.ActivePrinter = "\\U2-front-desk\TSC TTP-346M Pro on Ne06:"
        Case Else
            Application.ActivePrinter = "Brother DCP-7065DN Printer on Ne04:"
    End Select
    Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
    Application.EnableEvents = True
    Application.ActivePrinter = "Brother DCP-7065DN Printer on Ne04:"
End Sub
Reply With Quote
  #3  
Old 07-21-2020, 03:49 PM
trevorc trevorc is offline Print preview and print dialog Windows 7 32bit Print preview and print dialog Office 2013
Competent Performer
Print preview and print dialog
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

I did it.

I used this to select the printer then display the print and print preview dialog
It changes the active printer, then the command bar exe will show the correct printer i need.

Code:
   t = Application.Dialogs(xlDialogPrint).Application
    Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print preview and print dialog Print and print preview move graphics Aviendah Word 1 10-06-2016 08:36 AM
Print preview and print dialog Discrepancy between Weeknumber i nOnscreen Gantt Chart and print/print preview deesloop Project 7 07-22-2015 07:52 AM
Print preview and print dialog I cannot get print layout to match print preview survivo01 Word 4 05-22-2014 12:57 AM
Print preview and print dialog Print Layout View Differs from Print Preview & Printed Document terik222 Word 3 03-27-2013 02:43 PM
Print preview and print dialog Print preview and actual print do not match? anthrax19888 Word 1 10-12-2009 08:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:58 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