Using VBA to show Print Preview Screen Layout as shown in the Screenshot

sureworkis

New Member
Joined
Feb 7, 2024
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hello,

Working on Office 2021. Both the below methods does not show the Print Preview Screen Layout that I want:-

Application.Dialogs(xlDialogPrint).Show
ActiveWindow.SelectedSheets.PrintOut Preview:=True

May I know how do I achieve that? Thank you in advance.
 

Attachments

  • Excel Preview.png
    Excel Preview.png
    54.9 KB · Views: 15

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I was lazy. This should also do the trick:
VBA Code:
application.CommandBars.executemso "PrintPreviewAndPrint"
 
Upvote 1
Solution
I was lazy. This should also do the trick:
VBA Code:
application.CommandBars.executemso "PrintPreviewAndPrint"
Bravo, you are GREAT, SIR! I was too silly to miss out this command too!:ROFLMAO:.

One last question, if you are able to help further. When in the preview screen, the default ZOOM is in full page mode. How do I set it to Page Width layout as shown in my attached screenshot?
 

Attachments

  • Excel Preview2.png
    Excel Preview2.png
    38.4 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top