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: 8

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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: 0
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,069
Members
449,090
Latest member
fragment

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